Ejemplo n.º 1
0
        public void GetAllPhotos_Returns200OK_WhenDBHasOneResource()
        {
            mockRepo.Setup(repo => repo.GetAllFamilyPhotos()).Returns(GetFamilyPhotos(1));

            var controller = new PhotoController(mockRepo.Object, mapper);

            var result = controller.GetAllFamilyPhotos();

            Assert.IsType <OkObjectResult>(result.Result);
        }
Ejemplo n.º 2
0
        public void GetAllPhotos_ReturnsCorrectType_WhenDBHasOneResource()
        {
            mockRepo.Setup(repo => repo.GetAllFamilyPhotos()).Returns(GetFamilyPhotos(1));

            var controller = new PhotoController(mockRepo.Object, mapper);

            var result = controller.GetAllFamilyPhotos();

            Assert.IsType <ActionResult <IEnumerable <PhotoReadDto> > >(result);
        }
Ejemplo n.º 3
0
        public void GetAllPhotos_ReturnsOneItem_WhenDBHasOneResource()
        {
            mockRepo.Setup(repo => repo.GetAllFamilyPhotos()).Returns(GetFamilyPhotos(1));

            var controller = new PhotoController(mockRepo.Object, mapper);

            var result = controller.GetAllFamilyPhotos();

            var okResult = result.Result as OkObjectResult;

            var photos = okResult.Value as List <PhotoReadDto>;

            Assert.Single(photos);
        }