Exemplo n.º 1
0
        public void Login_ShouldRedirectAuthenticatedUserToHomePage()
        {
            // Setup Authentication Manager
            var authenticatedIdentity = new MockIdentity(true);
            var authenticatedUser     = new ClaimsPrincipal(authenticatedIdentity);

            var authenticationManager = new FakeAuthenticationManager()
                                        .WithUser(authenticatedUser).Build();

            // Call login method
            ActionResult result = _controller
                                  .WithAuthenticationManager(authenticationManager.Object).Build()
                                  .Login();

            // Verify user is redirected to Home page
            result.AssertIsRedirect("Home", "Index");
        }