当前位置: 首页>>代码示例>>C#>>正文


C# PetApi.GetPetById方法代码示例

本文整理汇总了C#中IO.Swagger.Api.PetApi.GetPetById方法的典型用法代码示例。如果您正苦于以下问题:C# PetApi.GetPetById方法的具体用法?C# PetApi.GetPetById怎么用?C# PetApi.GetPetById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IO.Swagger.Api.PetApi的用法示例。


在下文中一共展示了PetApi.GetPetById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestGetPetById

        public void TestGetPetById()
        {
            PetApi petApi = new PetApi ();
            Pet response = petApi.GetPetById (petId);
            Assert.IsInstanceOf<Pet> (response, "Response is a Pet");

            Assert.AreEqual ("Csharp test", response.Name);
            Assert.AreEqual ("available", response.Status);

            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.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);
        }
开发者ID:DariusMR,项目名称:swagger-codegen,代码行数:20,代码来源:TestPet.cs

示例2: TestUpdatePetWithForm

        public void TestUpdatePetWithForm()
        {
            PetApi petApi = new PetApi ();
            petApi.UpdatePetWithForm (petId.ToString(), "new form name", "pending");

            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 ("pending", response.Status);

            Assert.AreEqual (petId, response.Tags [0].Id);
            Assert.AreEqual (56, response.Category.Id);
        }
开发者ID:DariusMR,项目名称:swagger-codegen,代码行数:16,代码来源:TestPet.cs

示例3: GetPetByIdTest

        public void GetPetByIdTest()
        {
			// set timeout to 10 seconds
			Configuration c1 = new Configuration (timeout: 10000, userAgent: "TEST_USER_AGENT");

			PetApi petApi = new PetApi (c1);
			Pet response = petApi.GetPetById (petId);
			Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");

			Assert.AreEqual ("Csharp test", response.Name);
			Assert.AreEqual (Pet.StatusEnum.Available, response.Status);

			Assert.IsInstanceOfType(typeof(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.IsInstanceOfType(typeof(List<String>), response.PhotoUrls, "Response.PhotoUrls is a Array");
			Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]);

			Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
			Assert.AreEqual (56, response.Category.Id);
			Assert.AreEqual ("sample category name2", response.Category.Name);
        }
开发者ID:ckaeslin,项目名称:swagger-codegen,代码行数:23,代码来源:PetApiTests.cs

示例4: UpdatePetWithFormTest

        public void UpdatePetWithFormTest()
        {
			PetApi petApi = new PetApi ();
			petApi.UpdatePetWithForm (petId, "new form name", "pending");

			Pet response = petApi.GetPetById (petId);
			Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet");
			Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category");
			Assert.IsInstanceOfType(typeof(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);           
        }
开发者ID:ckaeslin,项目名称:swagger-codegen,代码行数:21,代码来源:PetApiTests.cs

示例5: TestGetPetById

        public void TestGetPetById()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration (timeout: 10000);

            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 ("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);
        }
开发者ID:SocialSuperstore,项目名称:swagger-codegen,代码行数:23,代码来源:TestPet.cs


注:本文中的IO.Swagger.Api.PetApi.GetPetById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。