Пример #1
0
        public void BookDetailsPost_CheckRedirectionAndSession(int id, int quantity)
        {
            using (var homeController = new HomeController(MockData.MoqLogger(), MockData.MoqShopContext(),
                                                           MockData.MoqEmailSender(), MockData.MoqMyLogger()))
            {
                var controllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                    {
                        Session = new MockHttpSession()
                    }
                };

                homeController.ControllerContext = controllerContext;

                var action = homeController.BookDetailsPost(id, quantity) as RedirectToActionResult;

                Assert.Equal("BookDetails", action.ActionName);
            }
        }