public async Task TestDeleteAnimalOwnershipInappropriateId() { var controller = new AnimalOwnershipsController(context); var ownedAnimal = await controller.DeleteAnimalOwnership(INAPPROPRIATE_ID_TO_FIND); // Assert var actionResult = Assert.IsType <ActionResult <AnimalOwnership> >(ownedAnimal); Assert.IsType <NotFoundResult>(actionResult.Result); }
public async Task TestDeleteAnimalOwnershipAppropriateId() { var controller = new AnimalOwnershipsController(context); AnimalOwnership ownedAnimal = context.AnimalOwnership.Find(ID_TO_FIND); Assert.False(ownedAnimal.IsDeleted); var deletedOwnedAnimal = await controller.DeleteAnimalOwnership(ID_TO_FIND); // Assert var actionResult = Assert.IsType <ActionResult <AnimalOwnership> >(deletedOwnedAnimal); Assert.True(deletedOwnedAnimal.Value.IsDeleted); ownedAnimal = context.AnimalOwnership.Find(ID_TO_FIND); Assert.True(ownedAnimal.IsDeleted); }