GetPetById() public method

Find pet by ID Returns a single pet
Thrown when fails to make API call
public GetPetById ( long petId ) : Pet
petId long ID of pet to return
return Pet
Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
        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);
        }
        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);           
        }
        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);
        }