Ejemplo n.º 1
0
        public void AccountController_LogOn_Returns_View()
        {
            // TODO check the data service to see if the login is valid.
            var accountController = new AccountController(
                new Mock<IFormsAuthenticationService>().Object,
                new Mock<IDataService<Volunteer>>().Object);

            ActionResult result = accountController.LogOn();

            //Assert.IsInstanceOf<ViewResult>(result);
            Assert.Inconclusive();
        }
Ejemplo n.º 2
0
        public void AccountController_LogOn_Post_Invalid_ModelState_Returns_View()
        {
            var accountController = new AccountController(
                new Mock<IFormsAuthenticationService>().Object,
                new Mock<IDataService<Volunteer>>().Object);

            accountController.ModelState.AddModelError("test", "error");

            var model = new LogOnViewModel();

            ActionResult result = accountController.LogOn(model, "home/index");

            Assert.IsInstanceOf<ViewResult>(result);
        }
Ejemplo n.º 3
0
        public void AccountController_LogOn_Post_Valid_User_Redirects()
        {
            var accountController = new AccountController(
                new Mock<IFormsAuthenticationService>().Object,
                new Mock<IDataService<Volunteer>>().Object);

            var model = new LogOnViewModel
                            {
                                Username = "******",
                                Password = "******",
                                RememberMe = false,
                            };

            ActionResult result = accountController.LogOn(model, "home/index");

            Assert.IsInstanceOf<RedirectResult>(result);
        }