Logout() private method

private Logout ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
コード例 #1
0
 public void Logout_ShouldCallSitecoreLogout(Database db, [Content] DbItem item, IAccountRepository repo, INotificationService ns, IAccountsSettingsService acc)
 {
     var fakeSite = new FakeSiteContext(new StringDictionary
                                        {
                                            {"rootPath", "/sitecore/content"},
                                            {"startItem", item.Name}
                                        }) as SiteContext;
     fakeSite.Database = db;
     using (new SiteContextSwitcher(fakeSite))
     {
         var ctrl = new AccountsController(repo, ns, acc, null, null);
         ctrl.Logout();
         repo.Received(1).Logout();
     }
 }
コード例 #2
0
        public void Logout_ShouldRedirectUserToHomePage(Database db, [Content] DbItem item, IAccountRepository repo, INotificationService ns, IAccountsSettingsService acc)
        {
            var fakeSite = new FakeSiteContext(new StringDictionary
                                               {
                                                   {"rootPath", "/sitecore/content"},
                                                   {"startItem", item.Name}
                                               }) as SiteContext;
            fakeSite.Database = db;
            Language.Current = Language.Invariant;

            using (new SiteContextSwitcher(fakeSite))
            {
                var ctrl = new AccountsController(repo, ns, acc, null, null);
                var result = ctrl.Logout();
                result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be("/");
            }
        }