public async Task Index_ReturnsAllVideos()
        {
            // Arrange
            var videoModel = new VideoConciseViewModel()
            {
                Id = 1, Title = "First"
            };
            bool methodCalled = false;

            var mockRepository = new Mock <IAdminVideosService>();

            mockRepository.Setup(s => s.GetAllVideosAsync())
            .ReturnsAsync(new[] { videoModel })
            .Callback(() => methodCalled = true);

            var userRepository = new Mock <IAdminUsersService>();

            userRepository.Setup(repo => repo.GetAuthorsAsync())
            .Callback(() => methodCalled = true);

            var controller = new VideosController(userRepository.Object, mockRepository.Object);

            // Act
            var result = await controller.Index();

            // Assert
            Assert.IsInstanceOfType(result, typeof(ViewResult));
            var resultView = result as ViewResult;

            Assert.IsNotNull(resultView.Model);
            Assert.IsInstanceOfType(resultView.Model, typeof(IEnumerable <VideoConciseViewModel>));
            Assert.IsTrue(methodCalled);
        }
        public void GetVideoGalleriesFromService_AndSetToViewModel()
        {
            // Arrange
            var mockedDTO = new VideoGalleryModel {
                Id = "1", Name = "First"
            };
            var galleries     = new VideoGalleryModel[] { mockedDTO };
            var mockedService = new Mock <IVideoService>();

            mockedService.Setup(s => s.GetAll()).Returns(galleries).Verifiable();

            var controller = new VideosController(mockedService.Object);

            // Act
            var view  = controller.Index() as ViewResult;
            var model = view.ViewData.Model as VideoGalleriesViewModel;

            // Assert
            Assert.IsTrue(model.Galleries.Count() == 2);
            Assert.IsTrue(model.Galleries.First().Value == "");
            Assert.IsTrue(model.Galleries.Last().Value == mockedDTO.Id);
            Assert.IsTrue(model.Galleries.Last().Text == mockedDTO.Name);
            mockedService.Verify(s => s.GetAll(), Times.Once);
        }
        public async void Index_ActionExecutes_ReturnView()
        {
            var result = await _controller.Index();

            Assert.IsType <ViewResult>(result);
        }