Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }