public void GetPet_ShouldReturnPetWithSameID() { var demo = GetDemoPet(); var context = new TestPetQuestContext(); context.Pets.Add(demo); var controller = new PetsController(context); var result = controller.GetPet(3) as OkNegotiatedContentResult <Pet>; Assert.IsNotNull(result); Assert.AreEqual(3, result.Content.ID); }
public void DeleteProduct_ShouldReturnOK() { var context = new TestPetQuestContext(); var item = GetDemoPet(); context.Pets.Add(item); var controller = new PetsController(context); var result = controller.DeletePet(3) as OkNegotiatedContentResult <Pet>; Assert.IsNotNull(result); Assert.AreEqual(item.ID, result.Content.ID); }
public void GetPets_ShouldReturnAllPets() { var context = new TestPetQuestContext(); context.Pets.Add(new Pet { Name = "Demo1", Location = "Demo" }); context.Pets.Add(new Pet { Name = "Demo2", Location = "Demo" }); context.Pets.Add(new Pet { Name = "Demo3", Location = "Demo" }); var controller = new PetsController(context); var result = controller.GetPets() as TestPetDbSet; Assert.IsNotNull(result); Assert.AreEqual(3, result.Local.Count); }