mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 10:07:11 +00:00
update test case, minor fix to required property in c#
This commit is contained in:
@@ -21,9 +21,9 @@ namespace SwaggerClientTest.TestPet
|
||||
private Pet createPet()
|
||||
{
|
||||
// create pet
|
||||
Pet p = new 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.Name = "Csharp test";
|
||||
p.Status = "available";
|
||||
// create Category object
|
||||
Category category = new Category();
|
||||
@@ -33,7 +33,7 @@ namespace SwaggerClientTest.TestPet
|
||||
// create Tag object
|
||||
Tag tag = new Tag();
|
||||
tag.Id = petId;
|
||||
tag.Name = "sample tag name1";
|
||||
tag.Name = "csharp sample tag name1";
|
||||
List<Tag> tags = new List<Tag>(new Tag[] {tag});
|
||||
p.Tags = tags;
|
||||
p.Category = category;
|
||||
@@ -86,7 +86,7 @@ namespace SwaggerClientTest.TestPet
|
||||
|
||||
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
|
||||
Assert.AreEqual (petId, response.Tags [0].Id);
|
||||
Assert.AreEqual ("sample tag name1", response.Tags [0].Name);
|
||||
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]);
|
||||
@@ -118,7 +118,7 @@ namespace SwaggerClientTest.TestPet
|
||||
|
||||
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
|
||||
Assert.AreEqual (petId, response.Tags [0].Id);
|
||||
Assert.AreEqual ("sample tag name1", response.Tags [0].Name);
|
||||
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]);
|
||||
@@ -147,7 +147,7 @@ namespace SwaggerClientTest.TestPet
|
||||
|
||||
Assert.IsInstanceOf<List<Tag>> (response.Tags, "Response.Tags is a Array");
|
||||
Assert.AreEqual (petId, response.Tags [0].Id);
|
||||
Assert.AreEqual ("sample tag name1", response.Tags [0].Name);
|
||||
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]);
|
||||
@@ -235,16 +235,16 @@ namespace SwaggerClientTest.TestPet
|
||||
/// Test FindPetByStatus
|
||||
/// </summary>
|
||||
[Test ()]
|
||||
public void TestFindPetByStatus ()
|
||||
public void TestFindPetByTags ()
|
||||
{
|
||||
PetApi petApi = new PetApi ();
|
||||
List<String> statusList = new List<String>(new String[] {"available"});
|
||||
List<String> tagsList = new List<String>(new String[] {"available"});
|
||||
|
||||
List<Pet> listPet = petApi.FindPetsByStatus (statusList);
|
||||
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 ("available", pet.Status);
|
||||
Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -256,9 +256,9 @@ namespace SwaggerClientTest.TestPet
|
||||
public void TestEqual()
|
||||
{
|
||||
// create pet
|
||||
Pet p1 = new 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.Name = "Csharp test";
|
||||
p1.Status = "available";
|
||||
// create Category object
|
||||
Category category1 = new Category();
|
||||
@@ -268,14 +268,14 @@ namespace SwaggerClientTest.TestPet
|
||||
// create Tag object
|
||||
Tag tag1 = new Tag();
|
||||
tag1.Id = petId;
|
||||
tag1.Name = "sample tag name1";
|
||||
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();
|
||||
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 = "available";
|
||||
@@ -287,7 +287,7 @@ namespace SwaggerClientTest.TestPet
|
||||
// create Tag object
|
||||
Tag tag2 = new Tag();
|
||||
tag2.Id = petId;
|
||||
tag2.Name = "sample tag name1";
|
||||
tag2.Name = "csharp sample tag name1";
|
||||
List<Tag> tags2 = new List<Tag>(new Tag[] {tag2});
|
||||
p2.Tags = tags2;
|
||||
p2.Category = category2;
|
||||
@@ -334,8 +334,9 @@ namespace SwaggerClientTest.TestPet
|
||||
public void TestDefaultHeader ()
|
||||
{
|
||||
PetApi petApi = new PetApi ();
|
||||
// comment out the warning test below as it's confirmed the warning is working as expecteds
|
||||
// there should be a warning for using AddDefaultHeader (deprecated) below
|
||||
petApi.AddDefaultHeader ("header_key", "header_value");
|
||||
//petApi.AddDefaultHeader ("header_key", "header_value");
|
||||
// the following should be used instead as suggested in the doc
|
||||
petApi.Configuration.AddDefaultHeader ("header_key2", "header_value2");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user