Ejemplo n.º 1
0
        public void BooksByPublisher_ShouldReturnValidModel(int publisherId)
        {
            using (var homeController = new HomeController(MockData.MoqLogger(), MockData.MoqShopContext(),
                                                           MockData.MoqEmailSender(), MockData.MoqMyLogger()))
            {
                var result = homeController.BooksByPublisher(publisherId) as ViewResult;
                var model  = result?.Model as IEnumerable <Book>;

                Assert.NotNull(model);

                Assert.Equal("Neustar, Inc.",
                             model.FirstOrDefault(x => x.Publisher.PublisherId == publisherId)?.Publisher.PublisherName);
                Assert.Equal(3, model.Count());
            }
        }