예제 #1
0
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController(new FakeDataFacade());

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
        public void Contact()
        {
            // Arrange
            HomeController controller = new HomeController(_facade);

            // Act
            ViewResult result = controller.Contact() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
예제 #3
0
        public void About()
        {
            // Arrange
            HomeController controller = new HomeController(new FakeDataFacade());

            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.AreEqual("Your application description page.", result.ViewBag.Message);
        }
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController(_facade);
            var mock = new Mock<ControllerContext>();
            mock.Setup(p => p.HttpContext.User.Identity.Name).Returns((string)null);
            mock.SetupGet(p => p.HttpContext.Request.IsAuthenticated).Returns(true);
            controller.ControllerContext = mock.Object;

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(null, result.ViewBag.UserDetails);
        }