public void UpdatePetWithForm_GivenExistentId_UpdatesTheFields() { Pet expected = BuildSamplePet(pet => { pet.Name = "name updated"; pet.Status = Pet.StatusEnum.Pending; }); _petApi.UpdatePetWithForm(PetId, "name updated", "pending"); Pet response = _petApi.GetPetById(PetId); Assert.IsType <Pet>(response); Assert.Equal(expected.Name, response.Name); Assert.Equal(expected.Status, response.Status); Assert.IsType <List <Tag> >(response.Tags); Assert.Equal(expected.Tags[0].Id, response.Tags[0].Id); Assert.Equal(expected.Tags[0].Name, response.Tags[0].Name); Assert.IsType <List <string> >(response.PhotoUrls); Assert.Equal(expected.PhotoUrls[0], response.PhotoUrls[0]); Assert.IsType <Category>(response.Category); Assert.Equal(expected.Category.Id, response.Category.Id); Assert.Equal(expected.Category.Name, response.Category.Name); _petApi.UpdatePetWithForm(PetId, "name updated twice"); response = _petApi.GetPetById(PetId); Assert.Equal("name updated twice", response.Name); }
public void UpdatePetWithFormTest() { // TODO: add unit test for the method 'UpdatePetWithForm' string petId = null; // TODO: replace null with proper value string name = null; // TODO: replace null with proper value string status = null; // TODO: replace null with proper value instance.UpdatePetWithForm(petId, name, status); }
public void UpdatePetWithFormTest() { PetApi petApi = new PetApi(); petApi.UpdatePetWithForm(petId, "new form name", "pending"); Pet response = petApi.GetPetById(petId); Assert.IsInstanceOf(typeof(Pet), response); Assert.IsInstanceOf(typeof(Category), response.Category); Assert.IsInstanceOf(typeof(List <Tag>), response.Tags); 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 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(Pet.StatusEnum.Pending, response.Status); Assert.AreEqual(petId, response.Tags [0].Id); Assert.AreEqual(56, response.Category.Id); // test optional parameter petApi.UpdatePetWithForm(petId.ToString(), "new form name2"); Pet response2 = petApi.GetPetById(petId); Assert.AreEqual("new form name2", response2.Name); }