public async Task TestPutAnimalOwnershipInappropriateId() { var controller = new AnimalOwnershipsController(context); AnimalOwnership ownedAnimal = context.AnimalOwnership.Find(ID_TO_FIND); var modifiedOwnedAnimal = await controller.PutAnimalOwnership(INAPPROPRIATE_ID_TO_FIND, ownedAnimal); // Assert var actionResult = Assert.IsType <ActionResult <AnimalOwnership> >(modifiedOwnedAnimal); Assert.IsType <BadRequestResult>(actionResult.Result); }
public async Task TestPutAnimalOwnershipAppropriateId() { var controller = new AnimalOwnershipsController(context); AnimalOwnership ownedAnimal = context.AnimalOwnership.Find(ID_TO_FIND); ownedAnimal.Name = CHANGED_TEXT; var modifiedOwnedAnimal = await controller.PutAnimalOwnership(ownedAnimal.Id, ownedAnimal); var actionResult = Assert.IsType <ActionResult <AnimalOwnership> >(modifiedOwnedAnimal); Assert.NotNull(actionResult); Assert.Equal(CHANGED_TEXT, actionResult.Value.Name); ownedAnimal = context.AnimalOwnership.Find(ID_TO_FIND); Assert.Equal(CHANGED_TEXT, ownedAnimal.Name); }