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(); } }
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("/"); } }