コード例 #1
0
        public async Task TestGetAllAnimalOwnership()
        {
            var controller   = new AnimalOwnershipsController(context);
            var ownedAnimals = await controller.GetAnimalOwnership();

            Assert.Equal(EXPECTED_SIZE_OF_ALL, ownedAnimals.Value.Count());
        }
コード例 #2
0
        public async Task TestGetAnimalOwnershipInappropriateId()
        {
            var controller  = new AnimalOwnershipsController(context);
            var ownedAnimal = await controller.GetAnimalOwnership(INAPPROPRIATE_ID_TO_FIND);

            // Assert
            var actionResult = Assert.IsType <ActionResult <AnimalOwnership> >(ownedAnimal);

            Assert.IsType <NotFoundResult>(actionResult.Result);
        }
コード例 #3
0
        public async Task TestGetAnimalOwnershipAppropriateId()
        {
            var controller  = new AnimalOwnershipsController(context);
            var ownedAnimal = await controller.GetAnimalOwnership(ID_TO_FIND);

            var actionResult = Assert.IsType <ActionResult <AnimalOwnership> >(ownedAnimal);

            Assert.NotNull(actionResult);
            Assert.Equal(ID_TO_FIND, actionResult.Value.Id);
        }