Exemple #1
0
        public void LoginShould_CallAuthProviderPropertyIsAuthenticated()
        {
            var authProviderMock = new Mock <IAuthenticationProvider>();
            var userServiceMock  = new Mock <IUserService>();

            var controller = new Web.Controllers.AccountController(authProviderMock.Object, userServiceMock.Object);

            controller.Login();

            authProviderMock.Verify(p => p.IsAuthenticated, Times.Once);
        }
Exemple #2
0
        public void LoginShould_RedirectToActionHomeIndex_WhenProviderIsAuthenticatedIsTrue()
        {
            var authProviderMock = new Mock <IAuthenticationProvider>();
            var userServiceMock  = new Mock <IUserService>();

            var controller = new Web.Controllers.AccountController(authProviderMock.Object, userServiceMock.Object);

            authProviderMock.Setup(p => p.IsAuthenticated).Returns(true);

            var result = controller.Login();

            Assert.IsInstanceOf <RedirectToRouteResult>(result);
        }