Beispiel #1
0
        public void LogOff()
        {
            var userManager   = MockHelpers.CreateMockUserManager();
            var signInManager = MockHelpers.CreateMockSignInManager();
            var urlHelper     = MockHelpers.CreateMockUrlHelper();
            var authManager   = MockHelpers.CreateMockAuthenticationManager();

            var controller = new AccountController(userManager.Object, signInManager.Object, urlHelper.Object, authManager.Object);

            var result = controller.LogOff();

            var redirect = result as RedirectToRouteResult;

            authManager.Verify(a => a.SignOut(DefaultAuthenticationTypes.ApplicationCookie));
            Assert.NotNull(redirect);
            Assert.Equal("Index", redirect.RouteValues["action"]);
            Assert.Equal("Home", redirect.RouteValues["controller"]);
        }