public void ShouldRenderTheDefaultView()
        {
            var serviceMock = new Mock<IMoviesService>();
            var controller = new MoviesController(serviceMock.Object);

            ViewResult result = controller.Index() as ViewResult;

            Assert.IsNotNull(result);
            Assert.AreEqual("", result.ViewName);
        }
 public void SetUp()
 {
     this._inMemoryMoviesService = new InMemoryMoviesService();
     this._inMemoryGroupsService = new InMemoryGroupsService();
     this._controller = new MoviesController(_inMemoryMoviesService, _inMemoryGroupsService);
 }
        public void ShouldPassAnIEnumerableOfMoviesAsModel()
        {
            var movies = new List<Movie>
            {
                new Movie { Title="foo" },
                new Movie { Title="bar" }
            };

            var service = new Mock<IMoviesService>();
            var controller = new MoviesController(service.Object);
            service.Setup(r => r.GetAllMovies())
                      .Returns(movies);

            ViewResult result = controller.Index() as ViewResult;
            IEnumerable<Movie> model = result.ViewData.Model as IEnumerable<Movie>;

            Assert.IsTrue(movies.SequenceEqual(model));
        }
 public void SetUp()
 {
     _inMemoryMoviesService = new InMemoryMoviesService();
     _controller = new MoviesController(this._inMemoryMoviesService);
 }