forked from loafle/openapi-generator-original
fix indention in tostring and constructor, add existing test cases to
auto-generated test files
This commit is contained in:
parent
f60bffe484
commit
373e5fbde2
@ -41,7 +41,10 @@
|
|||||||
{{/vars}}
|
{{/vars}}
|
||||||
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}})
|
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}})
|
||||||
{
|
{
|
||||||
{{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null)
|
{{#vars}}
|
||||||
|
{{^isReadOnly}}
|
||||||
|
{{#required}}
|
||||||
|
// to ensure "{{name}}" is required (not null)
|
||||||
if ({{name}} == null)
|
if ({{name}} == null)
|
||||||
{
|
{
|
||||||
throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null");
|
throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null");
|
||||||
@ -50,8 +53,12 @@
|
|||||||
{
|
{
|
||||||
this.{{name}} = {{name}};
|
this.{{name}} = {{name}};
|
||||||
}
|
}
|
||||||
{{/required}}{{/isReadOnly}}{{/vars}}
|
{{/required}}
|
||||||
{{#vars}}{{^isReadOnly}}{{^required}}
|
{{/isReadOnly}}
|
||||||
|
{{/vars}}
|
||||||
|
{{#vars}}
|
||||||
|
{{^isReadOnly}}
|
||||||
|
{{^required}}
|
||||||
{{#defaultValue}}// use default value if no "{{name}}" provided
|
{{#defaultValue}}// use default value if no "{{name}}" provided
|
||||||
if ({{name}} == null)
|
if ({{name}} == null)
|
||||||
{
|
{
|
||||||
@ -65,7 +72,9 @@
|
|||||||
{{^defaultValue}}
|
{{^defaultValue}}
|
||||||
this.{{name}} = {{name}};
|
this.{{name}} = {{name}};
|
||||||
{{/defaultValue}}
|
{{/defaultValue}}
|
||||||
{{/required}}{{/isReadOnly}}{{/vars}}
|
{{/required}}
|
||||||
|
{{/isReadOnly}}
|
||||||
|
{{/vars}}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
@ -86,7 +95,8 @@
|
|||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class {{classname}} {\n");
|
sb.Append("class {{classname}} {\n");
|
||||||
{{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
{{#vars}}
|
||||||
|
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
|
@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio 2012
|
# Visual Studio 2012
|
||||||
VisualStudioVersion = 12.0.0.0
|
VisualStudioVersion = 12.0.0.0
|
||||||
MinimumVisualStudioVersion = 10.0.0.1
|
MinimumVisualStudioVersion = 10.0.0.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{74456AF8-75EE-4ABC-97EB-CA96A472DD21}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- SDK version: 1.0.0
|
- SDK version: 1.0.0
|
||||||
- Build date: 2016-05-13T21:50:05.372+08:00
|
- Build date: 2016-05-16T15:24:50.194+08:00
|
||||||
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen
|
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen
|
||||||
|
|
||||||
## Frameworks supported
|
## Frameworks supported
|
||||||
|
@ -58,20 +58,22 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestEndpointParametersTest()
|
public void TestEndpointParametersTest()
|
||||||
{
|
{
|
||||||
|
/* comment out the following as the endpiont is fake
|
||||||
// TODO: add unit test for the method 'TestEndpointParameters'
|
// TODO: add unit test for the method 'TestEndpointParameters'
|
||||||
double? number = null; // TODO: replace null with proper value
|
double? number = 12.3; // TODO: replace null with proper value
|
||||||
double? _double = null; // TODO: replace null with proper value
|
double? _double = 34.5; // TODO: replace null with proper value
|
||||||
string _string = null; // TODO: replace null with proper value
|
string _string = "charp test"; // TODO: replace null with proper value
|
||||||
byte[] _byte = null; // TODO: replace null with proper value
|
byte[] _byte = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };; // TODO: replace null with proper value
|
||||||
int? integer = null; // TODO: replace null with proper value
|
int? integer = 3; // TODO: replace null with proper value
|
||||||
int? int32 = null; // TODO: replace null with proper value
|
int? int32 = 2; // TODO: replace null with proper value
|
||||||
long? int64 = null; // TODO: replace null with proper value
|
long? int64 = 1; // TODO: replace null with proper value
|
||||||
float? _float = null; // TODO: replace null with proper value
|
float? _float = 7.8F; // TODO: replace null with proper value
|
||||||
byte[] binary = null; // TODO: replace null with proper value
|
byte[] binary = null; // TODO: replace null with proper value
|
||||||
DateTime? date = null; // TODO: replace null with proper value
|
DateTime? date = null; // TODO: replace null with proper value
|
||||||
DateTime? dateTime = null; // TODO: replace null with proper value
|
DateTime? dateTime = null; // TODO: replace null with proper value
|
||||||
string password = null; // TODO: replace null with proper value
|
string password = null; // TODO: replace null with proper value
|
||||||
instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,45 @@ namespace IO.Swagger.Test
|
|||||||
{
|
{
|
||||||
private PetApi instance;
|
private PetApi instance;
|
||||||
|
|
||||||
|
private long petId = 11088;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a Pet object
|
||||||
|
/// </summary>
|
||||||
|
private Pet createPet()
|
||||||
|
{
|
||||||
|
// create pet
|
||||||
|
Pet p = new Pet(Name: "Csharp test", PhotoUrls: new List<string> { "http://petstore.com/csharp_test" });
|
||||||
|
p.Id = petId;
|
||||||
|
//p.Name = "Csharp test";
|
||||||
|
p.Status = Pet.StatusEnum.Available;
|
||||||
|
// create Category object
|
||||||
|
Category category = new Category();
|
||||||
|
category.Id = 56;
|
||||||
|
category.Name = "sample category name2";
|
||||||
|
List<String> photoUrls = new List<String>(new String[] {"sample photoUrls"});
|
||||||
|
// create Tag object
|
||||||
|
Tag tag = new Tag();
|
||||||
|
tag.Id = petId;
|
||||||
|
tag.Name = "csharp sample tag name1";
|
||||||
|
List<Tag> tags = new List<Tag>(new Tag[] {tag});
|
||||||
|
p.Tags = tags;
|
||||||
|
p.Category = category;
|
||||||
|
p.PhotoUrls = photoUrls;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Convert string to byte array
|
||||||
|
/// </summary>
|
||||||
|
private byte[] GetBytes(string str)
|
||||||
|
{
|
||||||
|
byte[] bytes = new byte[str.Length * sizeof(char)];
|
||||||
|
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup before each unit test
|
/// Setup before each unit test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,6 +71,13 @@ namespace IO.Swagger.Test
|
|||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
instance = new PetApi();
|
instance = new PetApi();
|
||||||
|
|
||||||
|
// create pet
|
||||||
|
Pet p = createPet();
|
||||||
|
|
||||||
|
// add pet before testing
|
||||||
|
PetApi petApi = new PetApi("http://petstore.swagger.io/v2/");
|
||||||
|
petApi.AddPet (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -40,7 +86,9 @@ namespace IO.Swagger.Test
|
|||||||
[TearDown]
|
[TearDown]
|
||||||
public void Cleanup()
|
public void Cleanup()
|
||||||
{
|
{
|
||||||
|
// remove the pet after testing
|
||||||
|
PetApi petApi = new PetApi ();
|
||||||
|
petApi.DeletePet(petId, "test key");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -59,10 +107,10 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void AddPetTest()
|
public void AddPetTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'AddPet'
|
// create pet
|
||||||
Pet body = null; // TODO: replace null with proper value
|
Pet p = createPet();
|
||||||
instance.AddPet(body);
|
|
||||||
|
|
||||||
|
instance.AddPet(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -71,11 +119,7 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void DeletePetTest()
|
public void DeletePetTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'DeletePet'
|
// no need to test as it'c covered by Cleanup() already
|
||||||
long? petId = null; // TODO: replace null with proper value
|
|
||||||
string apiKey = null; // TODO: replace null with proper value
|
|
||||||
instance.DeletePet(petId, apiKey);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -84,10 +128,15 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void FindPetsByStatusTest()
|
public void FindPetsByStatusTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'FindPetsByStatus'
|
PetApi petApi = new PetApi ();
|
||||||
List<string> status = null; // TODO: replace null with proper value
|
List<String> tagsList = new List<String>(new String[] {"available"});
|
||||||
var response = instance.FindPetsByStatus(status);
|
|
||||||
Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>");
|
List<Pet> listPet = petApi.FindPetsByTags (tagsList);
|
||||||
|
foreach (Pet pet in listPet) // Loop through List with foreach.
|
||||||
|
{
|
||||||
|
Assert.IsInstanceOf<Pet> (pet, "Response is a Pet");
|
||||||
|
Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -96,8 +145,7 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void FindPetsByTagsTest()
|
public void FindPetsByTagsTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'FindPetsByTags'
|
List<string> tags = new List<String>(new String[] {"pet"});
|
||||||
List<string> tags = null; // TODO: replace null with proper value
|
|
||||||
var response = instance.FindPetsByTags(tags);
|
var response = instance.FindPetsByTags(tags);
|
||||||
Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>");
|
Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>");
|
||||||
}
|
}
|
||||||
@ -108,10 +156,85 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void GetPetByIdTest()
|
public void GetPetByIdTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'GetPetById'
|
// set timeout to 10 seconds
|
||||||
long? petId = null; // TODO: replace null with proper value
|
Configuration c1 = new Configuration (timeout: 10000, userAgent: "TEST_USER_AGENT");
|
||||||
var response = instance.GetPetById(petId);
|
|
||||||
Assert.IsInstanceOf<Pet> (response, "response is Pet");
|
PetApi petApi = new PetApi (c1);
|
||||||
|
Pet response = petApi.GetPetById (petId);
|
||||||
|
Assert.IsInstanceOf<Pet> (response, "Response is a Pet");
|
||||||
|
|
||||||
|
Assert.AreEqual ("Csharp test", response.Name);
|
||||||
|
Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
|
||||||
|
Assert.AreEqual (petId, response.Tags [0].Id);
|
||||||
|
Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array");
|
||||||
|
Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category");
|
||||||
|
Assert.AreEqual (56, response.Category.Id);
|
||||||
|
Assert.AreEqual ("sample category name2", response.Category.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test GetPetByIdAsync
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestGetPetByIdAsync ()
|
||||||
|
{
|
||||||
|
PetApi petApi = new PetApi ();
|
||||||
|
var task = petApi.GetPetByIdAsync (petId);
|
||||||
|
Pet response = task.Result;
|
||||||
|
Assert.IsInstanceOf<Pet> (response, "Response is a Pet");
|
||||||
|
|
||||||
|
Assert.AreEqual ("Csharp test", response.Name);
|
||||||
|
Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
|
||||||
|
Assert.AreEqual (petId, response.Tags [0].Id);
|
||||||
|
Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array");
|
||||||
|
Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category");
|
||||||
|
Assert.AreEqual (56, response.Category.Id);
|
||||||
|
Assert.AreEqual ("sample category name2", response.Category.Name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test GetPetByIdAsyncWithHttpInfo
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestGetPetByIdAsyncWithHttpInfo ()
|
||||||
|
{
|
||||||
|
PetApi petApi = new PetApi ();
|
||||||
|
var task = petApi.GetPetByIdAsyncWithHttpInfo (petId);
|
||||||
|
|
||||||
|
Assert.AreEqual (200, task.Result.StatusCode);
|
||||||
|
Assert.IsTrue (task.Result.Headers.ContainsKey("Content-Type"));
|
||||||
|
Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json");
|
||||||
|
|
||||||
|
Pet response = task.Result.Data;
|
||||||
|
Assert.IsInstanceOf<Pet> (response, "Response is a Pet");
|
||||||
|
|
||||||
|
Assert.AreEqual ("Csharp test", response.Name);
|
||||||
|
Assert.AreEqual (Pet.StatusEnum.Available, response.Status);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
|
||||||
|
Assert.AreEqual (petId, response.Tags [0].Id);
|
||||||
|
Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<List<String>> (response.PhotoUrls, "Response.PhotoUrls is a Array");
|
||||||
|
Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);
|
||||||
|
|
||||||
|
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category");
|
||||||
|
Assert.AreEqual (56, response.Category.Id);
|
||||||
|
Assert.AreEqual ("sample category name2", response.Category.Name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -120,10 +243,9 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void UpdatePetTest()
|
public void UpdatePetTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'UpdatePet'
|
// create pet
|
||||||
Pet body = null; // TODO: replace null with proper value
|
Pet p = createPet();
|
||||||
instance.UpdatePet(body);
|
instance.UpdatePet(p);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -132,12 +254,24 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void UpdatePetWithFormTest()
|
public void UpdatePetWithFormTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'UpdatePetWithForm'
|
PetApi petApi = new PetApi ();
|
||||||
long? petId = null; // TODO: replace null with proper value
|
petApi.UpdatePetWithForm (petId, "new form name", "pending");
|
||||||
string name = null; // TODO: replace null with proper value
|
|
||||||
string status = null; // TODO: replace null with proper value
|
|
||||||
instance.UpdatePetWithForm(petId, name, status);
|
|
||||||
|
|
||||||
|
Pet response = petApi.GetPetById (petId);
|
||||||
|
Assert.IsInstanceOf<Pet> (response, "Response is a Pet");
|
||||||
|
Assert.IsInstanceOf<Category> (response.Category, "Response.Category is a Category");
|
||||||
|
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
|
||||||
|
|
||||||
|
Assert.AreEqual ("new form name", response.Name);
|
||||||
|
Assert.AreEqual (Pet.StatusEnum.Pending, response.Status);
|
||||||
|
|
||||||
|
Assert.AreEqual (petId, response.Tags [0].Id);
|
||||||
|
Assert.AreEqual (56, response.Category.Id);
|
||||||
|
|
||||||
|
// test optional parameter
|
||||||
|
petApi.UpdatePetWithForm (petId, "new form name2");
|
||||||
|
Pet response2 = petApi.GetPetById (petId);
|
||||||
|
Assert.AreEqual ("new form name2", response2.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -146,12 +280,44 @@ namespace IO.Swagger.Test
|
|||||||
[Test]
|
[Test]
|
||||||
public void UploadFileTest()
|
public void UploadFileTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'UploadFile'
|
Assembly _assembly = Assembly.GetExecutingAssembly();
|
||||||
long? petId = null; // TODO: replace null with proper value
|
Stream _imageStream = _assembly.GetManifestResourceStream("IO.Swagger.Test.swagger-logo.png");
|
||||||
string additionalMetadata = null; // TODO: replace null with proper value
|
PetApi petApi = new PetApi ();
|
||||||
System.IO.Stream file = null; // TODO: replace null with proper value
|
// test file upload with form parameters
|
||||||
var response = instance.UploadFile(petId, additionalMetadata, file);
|
petApi.UploadFile(petId, "new form name", _imageStream);
|
||||||
Assert.IsInstanceOf<ApiResponse> (response, "response is ApiResponse");
|
|
||||||
|
// test file upload without any form parameters
|
||||||
|
// using optional parameter syntax introduced at .net 4.0
|
||||||
|
petApi.UploadFile(petId: petId, file: _imageStream);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test status code
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestStatusCodeAndHeader ()
|
||||||
|
{
|
||||||
|
PetApi petApi = new PetApi ();
|
||||||
|
var response = petApi.GetPetByIdWithHttpInfo (petId);
|
||||||
|
Assert.AreEqual (response.StatusCode, 200);
|
||||||
|
Assert.IsTrue (response.Headers.ContainsKey("Content-Type"));
|
||||||
|
Assert.AreEqual (response.Headers["Content-Type"], "application/json");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test default header (should be deprecated
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestDefaultHeader ()
|
||||||
|
{
|
||||||
|
PetApi petApi = new PetApi ();
|
||||||
|
// commented out the warning test below as it's confirmed the warning is working as expected
|
||||||
|
// there should be a warning for using AddDefaultHeader (deprecated) below
|
||||||
|
//petApi.AddDefaultHeader ("header_key", "header_value");
|
||||||
|
// the following should be used instead as suggested in the doc
|
||||||
|
petApi.Configuration.AddDefaultHeader ("header_key2", "header_value2");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using IO.Swagger.Client;
|
using IO.Swagger.Client;
|
||||||
using IO.Swagger.Api;
|
using IO.Swagger.Api;
|
||||||
@ -60,8 +61,8 @@ namespace IO.Swagger.Test
|
|||||||
public void DeleteOrderTest()
|
public void DeleteOrderTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'DeleteOrder'
|
// TODO: add unit test for the method 'DeleteOrder'
|
||||||
string orderId = null; // TODO: replace null with proper value
|
//string orderId = null; // TODO: replace null with proper value
|
||||||
instance.DeleteOrder(orderId);
|
//instance.DeleteOrder(orderId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,8 +73,19 @@ namespace IO.Swagger.Test
|
|||||||
public void GetInventoryTest()
|
public void GetInventoryTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'GetInventory'
|
// TODO: add unit test for the method 'GetInventory'
|
||||||
var response = instance.GetInventory();
|
//var response = instance.GetInventory();
|
||||||
Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>");
|
//Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>");
|
||||||
|
|
||||||
|
// set timeout to 10 seconds
|
||||||
|
Configuration c1 = new Configuration (timeout: 10000);
|
||||||
|
|
||||||
|
StoreApi storeApi = new StoreApi (c1);
|
||||||
|
Dictionary<String, int?> response = storeApi.GetInventory ();
|
||||||
|
|
||||||
|
foreach(KeyValuePair<string, int?> entry in response)
|
||||||
|
{
|
||||||
|
Assert.IsInstanceOf (typeof(int?), entry.Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -83,9 +95,9 @@ namespace IO.Swagger.Test
|
|||||||
public void GetOrderByIdTest()
|
public void GetOrderByIdTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'GetOrderById'
|
// TODO: add unit test for the method 'GetOrderById'
|
||||||
long? orderId = null; // TODO: replace null with proper value
|
//long? orderId = null; // TODO: replace null with proper value
|
||||||
var response = instance.GetOrderById(orderId);
|
//var response = instance.GetOrderById(orderId);
|
||||||
Assert.IsInstanceOf<Order> (response, "response is Order");
|
//Assert.IsInstanceOf<Order> (response, "response is Order");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -95,11 +107,41 @@ namespace IO.Swagger.Test
|
|||||||
public void PlaceOrderTest()
|
public void PlaceOrderTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'PlaceOrder'
|
// TODO: add unit test for the method 'PlaceOrder'
|
||||||
Order body = null; // TODO: replace null with proper value
|
//Order body = null; // TODO: replace null with proper value
|
||||||
var response = instance.PlaceOrder(body);
|
//var response = instance.PlaceOrder(body);
|
||||||
Assert.IsInstanceOf<Order> (response, "response is Order");
|
//Assert.IsInstanceOf<Order> (response, "response is Order");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test Enum
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestEnum ()
|
||||||
|
{
|
||||||
|
Assert.AreEqual (Order.StatusEnum.Approved.ToString(), "Approved");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deserialization of JSON to Order and its readonly property
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TesOrderDeserialization()
|
||||||
|
{
|
||||||
|
string json = @"{
|
||||||
|
'id': 1982,
|
||||||
|
'petId': 1020,
|
||||||
|
'quantity': 1,
|
||||||
|
'status': 'placed',
|
||||||
|
'complete': true,
|
||||||
|
}";
|
||||||
|
var o = JsonConvert.DeserializeObject<Order>(json);
|
||||||
|
Assert.AreEqual (1982, o.Id);
|
||||||
|
Assert.AreEqual (1020, o.PetId);
|
||||||
|
Assert.AreEqual (1, o.Quantity);
|
||||||
|
Assert.AreEqual (Order.StatusEnum.Placed, o.Status);
|
||||||
|
Assert.AreEqual (true, o.Complete);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ namespace IO.Swagger.Test
|
|||||||
public void CreateUserTest()
|
public void CreateUserTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'CreateUser'
|
// TODO: add unit test for the method 'CreateUser'
|
||||||
User body = null; // TODO: replace null with proper value
|
//User body = null; // TODO: replace null with proper value
|
||||||
instance.CreateUser(body);
|
//instance.CreateUser(body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,8 +72,8 @@ namespace IO.Swagger.Test
|
|||||||
public void CreateUsersWithArrayInputTest()
|
public void CreateUsersWithArrayInputTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'CreateUsersWithArrayInput'
|
// TODO: add unit test for the method 'CreateUsersWithArrayInput'
|
||||||
List<User> body = null; // TODO: replace null with proper value
|
//List<User> body = null; // TODO: replace null with proper value
|
||||||
instance.CreateUsersWithArrayInput(body);
|
//instance.CreateUsersWithArrayInput(body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +84,8 @@ namespace IO.Swagger.Test
|
|||||||
public void CreateUsersWithListInputTest()
|
public void CreateUsersWithListInputTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'CreateUsersWithListInput'
|
// TODO: add unit test for the method 'CreateUsersWithListInput'
|
||||||
List<User> body = null; // TODO: replace null with proper value
|
//List<User> body = null; // TODO: replace null with proper value
|
||||||
instance.CreateUsersWithListInput(body);
|
//instance.CreateUsersWithListInput(body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ namespace IO.Swagger.Test
|
|||||||
public void DeleteUserTest()
|
public void DeleteUserTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'DeleteUser'
|
// TODO: add unit test for the method 'DeleteUser'
|
||||||
string username = null; // TODO: replace null with proper value
|
//string username = null; // TODO: replace null with proper value
|
||||||
instance.DeleteUser(username);
|
//instance.DeleteUser(username);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,9 +108,9 @@ namespace IO.Swagger.Test
|
|||||||
public void GetUserByNameTest()
|
public void GetUserByNameTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'GetUserByName'
|
// TODO: add unit test for the method 'GetUserByName'
|
||||||
string username = null; // TODO: replace null with proper value
|
//string username = null; // TODO: replace null with proper value
|
||||||
var response = instance.GetUserByName(username);
|
//var response = instance.GetUserByName(username);
|
||||||
Assert.IsInstanceOf<User> (response, "response is User");
|
//Assert.IsInstanceOf<User> (response, "response is User");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -120,10 +120,10 @@ namespace IO.Swagger.Test
|
|||||||
public void LoginUserTest()
|
public void LoginUserTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'LoginUser'
|
// TODO: add unit test for the method 'LoginUser'
|
||||||
string username = null; // TODO: replace null with proper value
|
//string username = null; // TODO: replace null with proper value
|
||||||
string password = null; // TODO: replace null with proper value
|
//string password = null; // TODO: replace null with proper value
|
||||||
var response = instance.LoginUser(username, password);
|
//var response = instance.LoginUser(username, password);
|
||||||
Assert.IsInstanceOf<string> (response, "response is string");
|
//Assert.IsInstanceOf<string> (response, "response is string");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -133,7 +133,7 @@ namespace IO.Swagger.Test
|
|||||||
public void LogoutUserTest()
|
public void LogoutUserTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'LogoutUser'
|
// TODO: add unit test for the method 'LogoutUser'
|
||||||
instance.LogoutUser();
|
//instance.LogoutUser();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,9 +144,9 @@ namespace IO.Swagger.Test
|
|||||||
public void UpdateUserTest()
|
public void UpdateUserTest()
|
||||||
{
|
{
|
||||||
// TODO: add unit test for the method 'UpdateUser'
|
// TODO: add unit test for the method 'UpdateUser'
|
||||||
string username = null; // TODO: replace null with proper value
|
//string username = null; // TODO: replace null with proper value
|
||||||
User body = null; // TODO: replace null with proper value
|
//User body = null; // TODO: replace null with proper value
|
||||||
instance.UpdateUser(username, body);
|
//instance.UpdateUser(username, body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using IO.Swagger.Client;
|
||||||
|
using IO.Swagger.Api;
|
||||||
|
using IO.Swagger.Model;
|
||||||
|
|
||||||
|
namespace IO.Swagger.Test
|
||||||
|
{
|
||||||
|
public class ApiClientTests
|
||||||
|
{
|
||||||
|
public ApiClientTests ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[TearDown()]
|
||||||
|
public void TearDown()
|
||||||
|
{
|
||||||
|
// Reset to default, just in case
|
||||||
|
Configuration.Default.DateTimeFormat = "o";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test SelectHeaderContentType
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestSelectHeaderContentType ()
|
||||||
|
{
|
||||||
|
ApiClient api = new ApiClient ();
|
||||||
|
String[] contentTypes = new String[] { "application/json", "application/xml" };
|
||||||
|
Assert.AreEqual("application/json", api.SelectHeaderContentType (contentTypes));
|
||||||
|
|
||||||
|
contentTypes = new String[] { "application/xml" };
|
||||||
|
Assert.AreEqual("application/xml", api.SelectHeaderContentType (contentTypes));
|
||||||
|
|
||||||
|
contentTypes = new String[] {};
|
||||||
|
Assert.IsNull(api.SelectHeaderContentType (contentTypes));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test ParameterToString
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestParameterToString ()
|
||||||
|
{
|
||||||
|
ApiClient api = new ApiClient ();
|
||||||
|
|
||||||
|
// test array of string
|
||||||
|
List<string> statusList = new List<String>(new String[] {"available", "sold"});
|
||||||
|
Assert.AreEqual("available,sold", api.ParameterToString (statusList));
|
||||||
|
|
||||||
|
// test array of int
|
||||||
|
List<int> numList = new List<int>(new int[] {1, 37});
|
||||||
|
Assert.AreEqual("1,37", api.ParameterToString (numList));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestParameterToStringForDateTime ()
|
||||||
|
{
|
||||||
|
ApiClient api = new ApiClient ();
|
||||||
|
|
||||||
|
// test datetime
|
||||||
|
DateTime dateUtc = DateTime.Parse ("2008-04-10T13:30:00.0000000z", null, System.Globalization.DateTimeStyles.RoundtripKind);
|
||||||
|
Assert.AreEqual ("2008-04-10T13:30:00.0000000Z", api.ParameterToString (dateUtc));
|
||||||
|
|
||||||
|
// test datetime with no timezone
|
||||||
|
DateTime dateWithNoTz = DateTime.Parse ("2008-04-10T13:30:00.000", null, System.Globalization.DateTimeStyles.RoundtripKind);
|
||||||
|
Assert.AreEqual ("2008-04-10T13:30:00.0000000", api.ParameterToString (dateWithNoTz));
|
||||||
|
}
|
||||||
|
|
||||||
|
// The test below only passes when running at -04:00 timezone
|
||||||
|
[Ignore ()]
|
||||||
|
public void TestParameterToStringWithTimeZoneForDateTime ()
|
||||||
|
{
|
||||||
|
ApiClient api = new ApiClient ();
|
||||||
|
// test datetime with a time zone
|
||||||
|
DateTimeOffset dateWithTz = DateTimeOffset.Parse("2008-04-10T13:30:00.0000000-04:00", null, System.Globalization.DateTimeStyles.RoundtripKind);
|
||||||
|
Assert.AreEqual("2008-04-10T13:30:00.0000000-04:00", api.ParameterToString(dateWithTz));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestParameterToStringForDateTimeWithUFormat ()
|
||||||
|
{
|
||||||
|
// Setup the DateTimeFormat across all of the calls
|
||||||
|
Configuration.Default.DateTimeFormat = "u";
|
||||||
|
ApiClient api = new ApiClient();
|
||||||
|
|
||||||
|
// test datetime
|
||||||
|
DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind);
|
||||||
|
Assert.AreEqual("2009-06-15 20:45:30Z", api.ParameterToString(dateUtc));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestParameterToStringForDateTimeWithCustomFormat ()
|
||||||
|
{
|
||||||
|
// Setup the DateTimeFormat across all of the calls
|
||||||
|
Configuration.Default.DateTimeFormat = "dd/MM/yy HH:mm:ss";
|
||||||
|
ApiClient api = new ApiClient();
|
||||||
|
|
||||||
|
// test datetime
|
||||||
|
DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind);
|
||||||
|
Assert.AreEqual("15/06/09 20:45:30", api.ParameterToString(dateUtc));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestSanitizeFilename ()
|
||||||
|
{
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("sun.gif"));
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("../sun.gif"));
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("/var/tmp/sun.gif"));
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("./sun.gif"));
|
||||||
|
|
||||||
|
Assert.AreEqual("sun", ApiClient.SanitizeFilename("sun"));
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("..\\sun.gif"));
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("\\var\\tmp\\sun.gif"));
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("c:\\var\\tmp\\sun.gif"));
|
||||||
|
Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename(".\\sun.gif"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestApiClientInstance ()
|
||||||
|
{
|
||||||
|
PetApi p1 = new PetApi ();
|
||||||
|
PetApi p2 = new PetApi ();
|
||||||
|
|
||||||
|
Configuration c1 = new Configuration (); // using default ApiClient
|
||||||
|
PetApi p3 = new PetApi (c1);
|
||||||
|
|
||||||
|
ApiClient a1 = new ApiClient();
|
||||||
|
Configuration c2 = new Configuration (a1); // using "a1" as the ApiClient
|
||||||
|
PetApi p4 = new PetApi (c2);
|
||||||
|
|
||||||
|
|
||||||
|
// ensure both using the same default ApiClient
|
||||||
|
Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient);
|
||||||
|
Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient);
|
||||||
|
|
||||||
|
// ensure both using the same default ApiClient
|
||||||
|
Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient);
|
||||||
|
Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient);
|
||||||
|
|
||||||
|
// ensure it's not using the default ApiClient
|
||||||
|
Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient);
|
||||||
|
Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using IO.Swagger.Client;
|
||||||
|
using IO.Swagger.Api;
|
||||||
|
using IO.Swagger.Model;
|
||||||
|
|
||||||
|
namespace IO.Swagger.Test
|
||||||
|
{
|
||||||
|
public class ConfigurationTests
|
||||||
|
{
|
||||||
|
public ConfigurationTests ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[TearDown ()]
|
||||||
|
public void TearDown ()
|
||||||
|
{
|
||||||
|
// Reset to default, just in case
|
||||||
|
Configuration.Default.DateTimeFormat = "o";
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestAuthentication ()
|
||||||
|
{
|
||||||
|
Configuration c = new Configuration ();
|
||||||
|
c.Username = "test_username";
|
||||||
|
c.Password = "test_password";
|
||||||
|
|
||||||
|
c.ApiKey ["api_key_identifier"] = "1233456778889900";
|
||||||
|
c.ApiKeyPrefix ["api_key_identifier"] = "PREFIX";
|
||||||
|
Assert.AreEqual (c.GetApiKeyWithPrefix("api_key_identifier"), "PREFIX 1233456778889900");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestBasePath ()
|
||||||
|
{
|
||||||
|
PetApi p = new PetApi ("http://new-basepath.com");
|
||||||
|
Assert.AreEqual (p.Configuration.ApiClient.RestClient.BaseUrl, "http://new-basepath.com");
|
||||||
|
// Given that PetApi is initailized with a base path, a new configuration (with a new ApiClient)
|
||||||
|
// is created by default
|
||||||
|
Assert.AreNotSame (p.Configuration, Configuration.Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestDateTimeFormat_Default ()
|
||||||
|
{
|
||||||
|
// Should default to the Round-trip Format Specifier - "o"
|
||||||
|
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
|
||||||
|
Assert.AreEqual("o", Configuration.Default.DateTimeFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestDateTimeFormat_UType()
|
||||||
|
{
|
||||||
|
Configuration.Default.DateTimeFormat = "u";
|
||||||
|
|
||||||
|
Assert.AreEqual("u", Configuration.Default.DateTimeFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestConstructor()
|
||||||
|
{
|
||||||
|
Configuration c = new Configuration (username: "test username", password: "test password");
|
||||||
|
Assert.AreEqual (c.Username, "test username");
|
||||||
|
Assert.AreEqual (c.Password, "test password");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestDefautlConfiguration ()
|
||||||
|
{
|
||||||
|
PetApi p1 = new PetApi ();
|
||||||
|
PetApi p2 = new PetApi ();
|
||||||
|
Assert.AreSame (p1.Configuration, p2.Configuration);
|
||||||
|
// same as the default
|
||||||
|
Assert.AreSame (p1.Configuration, Configuration.Default);
|
||||||
|
|
||||||
|
Configuration c = new Configuration ();
|
||||||
|
Assert.AreNotSame (c, p1.Configuration);
|
||||||
|
|
||||||
|
PetApi p3 = new PetApi (c);
|
||||||
|
// same as c
|
||||||
|
Assert.AreSame (p3.Configuration, c);
|
||||||
|
// not same as default
|
||||||
|
Assert.AreNotSame (p3.Configuration, p1.Configuration);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestUsage ()
|
||||||
|
{
|
||||||
|
// basic use case using default base URL
|
||||||
|
PetApi p1 = new PetApi ();
|
||||||
|
Assert.AreSame (p1.Configuration, Configuration.Default, "PetApi should use default configuration");
|
||||||
|
|
||||||
|
// using a different base URL
|
||||||
|
PetApi p2 = new PetApi ("http://new-base-url.com/");
|
||||||
|
Assert.AreEqual (p2.Configuration.ApiClient.RestClient.BaseUrl.ToString(), "http://new-base-url.com/");
|
||||||
|
|
||||||
|
// using a different configuration
|
||||||
|
Configuration c1 = new Configuration ();
|
||||||
|
PetApi p3 = new PetApi (c1);
|
||||||
|
Assert.AreSame (p3.Configuration, c1);
|
||||||
|
|
||||||
|
// using a different base URL via a new ApiClient
|
||||||
|
ApiClient a1 = new ApiClient ("http://new-api-client.com");
|
||||||
|
Configuration c2 = new Configuration (a1);
|
||||||
|
PetApi p4 = new PetApi (c2);
|
||||||
|
Assert.AreSame (p4.Configuration.ApiClient, a1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test ()]
|
||||||
|
public void TestTimeout ()
|
||||||
|
{
|
||||||
|
Configuration c1 = new Configuration ();
|
||||||
|
Assert.AreEqual (100000, c1.Timeout); // default vaue
|
||||||
|
|
||||||
|
c1.Timeout = 50000;
|
||||||
|
Assert.AreEqual (50000, c1.Timeout);
|
||||||
|
|
||||||
|
Configuration c2 = new Configuration (timeout: 20000);
|
||||||
|
Assert.AreEqual (20000, c2.Timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
@ -58,6 +58,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="**\*.cs" />
|
<Compile Include="**\*.cs" />
|
||||||
|
<Compile Include="Client\ApiClientTests.cs" />
|
||||||
|
<Compile Include="Client\ConfigurationTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
@ -65,9 +67,14 @@
|
|||||||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
|
<ProjectReference Include="..\IO.Swagger\IO.Swagger.csproj">
|
||||||
<Project>{74456AF8-75EE-4ABC-97EB-CA96A472DD21}</Project>
|
<Project>{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}</Project>
|
||||||
<Name>IO.Swagger</Name>
|
<Name>IO.Swagger</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="swagger-logo.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Client\" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace IO.Swagger.Test
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
instance = new Animal();
|
instance = new Animal(ClassName: "csharp test");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -29,7 +29,7 @@ namespace IO.Swagger.Test
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
instance = new Cat();
|
instance = new Cat(ClassName: "csharp test");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -29,7 +29,7 @@ namespace IO.Swagger.Test
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
instance = new Dog();
|
instance = new Dog(ClassName: "csharp test");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -50,6 +50,22 @@ namespace IO.Swagger.Test
|
|||||||
Assert.IsInstanceOf<EnumClass> (instance, "instance is a EnumClass");
|
Assert.IsInstanceOf<EnumClass> (instance, "instance is a EnumClass");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test EnumClass
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void EnumClassValueTest ()
|
||||||
|
{
|
||||||
|
// test serialization for string
|
||||||
|
Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumClass.Abc), "\"_abc\"");
|
||||||
|
|
||||||
|
// test serialization for number
|
||||||
|
Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1), "\"-1\"");
|
||||||
|
|
||||||
|
// test cast to int
|
||||||
|
Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS_1, -1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace IO.Swagger.Test
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
instance = new FormatTest();
|
instance = new FormatTest(Number: 123, _Byte: new byte[] { 0x20 }, Date: new DateTime(2015, 1, 18), Password: "xyz");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -29,7 +29,7 @@ namespace IO.Swagger.Test
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
instance = new Name();
|
instance = new Name(_Name: 1, Property: "csharp");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -41,6 +41,16 @@ namespace IO.Swagger.Test
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test creating a new instance of Order
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestNewOrder()
|
||||||
|
{
|
||||||
|
Order o = new Order ();
|
||||||
|
Assert.IsNull (o.Id);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test an instance of Order
|
/// Test an instance of Order
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -23,13 +23,15 @@ namespace IO.Swagger.Test
|
|||||||
{
|
{
|
||||||
private Pet instance;
|
private Pet instance;
|
||||||
|
|
||||||
|
private long petId = 11088;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Setup before each test
|
/// Setup before each test
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
instance = new Pet();
|
instance = new Pet(Name: "Csharp test", PhotoUrls: new List<string> { "http://petstore.com/csharp_test" });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -99,6 +101,69 @@ namespace IO.Swagger.Test
|
|||||||
// TODO: unit test for the property 'Status'
|
// TODO: unit test for the property 'Status'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test Equal
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestEqual()
|
||||||
|
{
|
||||||
|
// create pet
|
||||||
|
Pet p1 = new Pet (Name: "Csharp test", PhotoUrls: new List<string> { "http://petstore.com/csharp_test" });
|
||||||
|
p1.Id = petId;
|
||||||
|
//p1.Name = "Csharp test";
|
||||||
|
p1.Status = Pet.StatusEnum.Available;
|
||||||
|
// create Category object
|
||||||
|
Category category1 = new Category ();
|
||||||
|
category1.Id = 56;
|
||||||
|
category1.Name = "sample category name2";
|
||||||
|
List<String> photoUrls1 = new List<String> (new String[] { "sample photoUrls" });
|
||||||
|
// create Tag object
|
||||||
|
Tag tag1 = new Tag ();
|
||||||
|
tag1.Id = petId;
|
||||||
|
tag1.Name = "csharp sample tag name1";
|
||||||
|
List<Tag> tags1 = new List<Tag> (new Tag[] { tag1 });
|
||||||
|
p1.Tags = tags1;
|
||||||
|
p1.Category = category1;
|
||||||
|
p1.PhotoUrls = photoUrls1;
|
||||||
|
|
||||||
|
// create pet 2
|
||||||
|
Pet p2 = new Pet (Name: "Csharp test", PhotoUrls: new List<string> { "http://petstore.com/csharp_test" });
|
||||||
|
p2.Id = petId;
|
||||||
|
p2.Name = "Csharp test";
|
||||||
|
p2.Status = Pet.StatusEnum.Available;
|
||||||
|
// create Category object
|
||||||
|
Category category2 = new Category ();
|
||||||
|
category2.Id = 56;
|
||||||
|
category2.Name = "sample category name2";
|
||||||
|
List<String> photoUrls2 = new List<String> (new String[] { "sample photoUrls" });
|
||||||
|
// create Tag object
|
||||||
|
Tag tag2 = new Tag ();
|
||||||
|
tag2.Id = petId;
|
||||||
|
tag2.Name = "csharp sample tag name1";
|
||||||
|
List<Tag> tags2 = new List<Tag> (new Tag[] { tag2 });
|
||||||
|
p2.Tags = tags2;
|
||||||
|
p2.Category = category2;
|
||||||
|
p2.PhotoUrls = photoUrls2;
|
||||||
|
|
||||||
|
// p1 and p2 should be equal (both object and attribute level)
|
||||||
|
Assert.IsTrue (category1.Equals (category2));
|
||||||
|
Assert.IsTrue (tags1.SequenceEqual (tags2));
|
||||||
|
Assert.IsTrue (p1.PhotoUrls.SequenceEqual (p2.PhotoUrls));
|
||||||
|
|
||||||
|
Assert.IsTrue (p1.Equals (p2));
|
||||||
|
|
||||||
|
// update attribute to that p1 and p2 are not equal
|
||||||
|
category2.Name = "new category name";
|
||||||
|
Assert.IsFalse (category1.Equals (category2));
|
||||||
|
|
||||||
|
tags2 = new List<Tag> ();
|
||||||
|
Assert.IsFalse (tags1.SequenceEqual (tags2));
|
||||||
|
|
||||||
|
// photoUrls has not changed so it should be equal
|
||||||
|
Assert.IsTrue (p1.PhotoUrls.SequenceEqual (p2.PhotoUrls));
|
||||||
|
|
||||||
|
Assert.IsFalse (p1.Equals (p2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{74456AF8-75EE-4ABC-97EB-CA96A472DD21}</ProjectGuid>
|
<ProjectGuid>{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Swagger Library</RootNamespace>
|
<RootNamespace>Swagger Library</RootNamespace>
|
||||||
|
@ -38,8 +38,6 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.ClassName = ClassName;
|
this.ClassName = ClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// use default value if no "Color" provided
|
// use default value if no "Color" provided
|
||||||
if (Color == null)
|
if (Color == null)
|
||||||
{
|
{
|
||||||
@ -49,7 +47,6 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.Color = Color;
|
this.Color = Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -22,8 +22,6 @@ namespace IO.Swagger.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public AnimalFarm()
|
public AnimalFarm()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -25,14 +25,9 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="Message">Message.</param>
|
/// <param name="Message">Message.</param>
|
||||||
public ApiResponse(int? Code = null, string Type = null, string Message = null)
|
public ApiResponse(int? Code = null, string Type = null, string Message = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Code = Code;
|
this.Code = Code;
|
||||||
|
|
||||||
this.Type = Type;
|
this.Type = Type;
|
||||||
|
|
||||||
this.Message = Message;
|
this.Message = Message;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,8 +39,6 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.ClassName = ClassName;
|
this.ClassName = ClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// use default value if no "Color" provided
|
// use default value if no "Color" provided
|
||||||
if (Color == null)
|
if (Color == null)
|
||||||
{
|
{
|
||||||
@ -50,9 +48,7 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.Color = Color;
|
this.Color = Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Declawed = Declawed;
|
this.Declawed = Declawed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -24,12 +24,8 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="Name">Name.</param>
|
/// <param name="Name">Name.</param>
|
||||||
public Category(long? Id = null, string Name = null)
|
public Category(long? Id = null, string Name = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,8 +39,6 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.ClassName = ClassName;
|
this.ClassName = ClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// use default value if no "Color" provided
|
// use default value if no "Color" provided
|
||||||
if (Color == null)
|
if (Color == null)
|
||||||
{
|
{
|
||||||
@ -50,9 +48,7 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.Color = Color;
|
this.Color = Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Breed = Breed;
|
this.Breed = Breed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -100,14 +100,9 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="EnumNumber">EnumNumber.</param>
|
/// <param name="EnumNumber">EnumNumber.</param>
|
||||||
public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null)
|
public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.EnumString = EnumString;
|
this.EnumString = EnumString;
|
||||||
|
|
||||||
this.EnumInteger = EnumInteger;
|
this.EnumInteger = EnumInteger;
|
||||||
|
|
||||||
this.EnumNumber = EnumNumber;
|
this.EnumNumber = EnumNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -76,26 +76,15 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.Password = Password;
|
this.Password = Password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.Integer = Integer;
|
this.Integer = Integer;
|
||||||
|
|
||||||
this.Int32 = Int32;
|
this.Int32 = Int32;
|
||||||
|
|
||||||
this.Int64 = Int64;
|
this.Int64 = Int64;
|
||||||
|
|
||||||
this._Float = _Float;
|
this._Float = _Float;
|
||||||
|
|
||||||
this._Double = _Double;
|
this._Double = _Double;
|
||||||
|
|
||||||
this._String = _String;
|
this._String = _String;
|
||||||
|
|
||||||
this.Binary = Binary;
|
this.Binary = Binary;
|
||||||
|
|
||||||
this.DateTime = DateTime;
|
this.DateTime = DateTime;
|
||||||
|
|
||||||
this.Uuid = Uuid;
|
this.Uuid = Uuid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,10 +23,7 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="Name">Name.</param>
|
/// <param name="Name">Name.</param>
|
||||||
public Model200Response(int? Name = null)
|
public Model200Response(int? Name = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,10 +23,7 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="_Return">_Return.</param>
|
/// <param name="_Return">_Return.</param>
|
||||||
public ModelReturn(int? _Return = null)
|
public ModelReturn(int? _Return = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this._Return = _Return;
|
this._Return = _Return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -38,10 +38,7 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this._Name = _Name;
|
this._Name = _Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.Property = Property;
|
this.Property = Property;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -61,18 +61,11 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="Complete">Complete (default to false).</param>
|
/// <param name="Complete">Complete (default to false).</param>
|
||||||
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null)
|
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.PetId = PetId;
|
this.PetId = PetId;
|
||||||
|
|
||||||
this.Quantity = Quantity;
|
this.Quantity = Quantity;
|
||||||
|
|
||||||
this.ShipDate = ShipDate;
|
this.ShipDate = ShipDate;
|
||||||
|
|
||||||
this.Status = Status;
|
this.Status = Status;
|
||||||
|
|
||||||
// use default value if no "Complete" provided
|
// use default value if no "Complete" provided
|
||||||
if (Complete == null)
|
if (Complete == null)
|
||||||
{
|
{
|
||||||
@ -82,7 +75,6 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.Complete = Complete;
|
this.Complete = Complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -84,16 +84,10 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.PhotoUrls = PhotoUrls;
|
this.PhotoUrls = PhotoUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Category = Category;
|
this.Category = Category;
|
||||||
|
|
||||||
this.Tags = Tags;
|
this.Tags = Tags;
|
||||||
|
|
||||||
this.Status = Status;
|
this.Status = Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,10 +23,7 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="SpecialPropertyName">SpecialPropertyName.</param>
|
/// <param name="SpecialPropertyName">SpecialPropertyName.</param>
|
||||||
public SpecialModelName(long? SpecialPropertyName = null)
|
public SpecialModelName(long? SpecialPropertyName = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.SpecialPropertyName = SpecialPropertyName;
|
this.SpecialPropertyName = SpecialPropertyName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -24,12 +24,8 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="Name">Name.</param>
|
/// <param name="Name">Name.</param>
|
||||||
public Tag(long? Id = null, string Name = null)
|
public Tag(long? Id = null, string Name = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -30,24 +30,14 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="UserStatus">User Status.</param>
|
/// <param name="UserStatus">User Status.</param>
|
||||||
public User(long? Id = null, string Username = null, string FirstName = null, string LastName = null, string Email = null, string Password = null, string Phone = null, int? UserStatus = null)
|
public User(long? Id = null, string Username = null, string FirstName = null, string LastName = null, string Email = null, string Password = null, string Phone = null, int? UserStatus = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Username = Username;
|
this.Username = Username;
|
||||||
|
|
||||||
this.FirstName = FirstName;
|
this.FirstName = FirstName;
|
||||||
|
|
||||||
this.LastName = LastName;
|
this.LastName = LastName;
|
||||||
|
|
||||||
this.Email = Email;
|
this.Email = Email;
|
||||||
|
|
||||||
this.Password = Password;
|
this.Password = Password;
|
||||||
|
|
||||||
this.Phone = Phone;
|
this.Phone = Phone;
|
||||||
|
|
||||||
this.UserStatus = UserStatus;
|
this.UserStatus = UserStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user