public void ShouldNotRedirectAuthenticatedUser([Substitute]AuthorizationContext filterContext, RedirectUnauthenticatedAttribute redirectUnauthenticated)
 {
     using (new Sitecore.Security.Accounts.UserSwitcher(@"extranet\John", true))
       {
     redirectUnauthenticated.OnAuthorization(filterContext);
     filterContext.Result.Should().BeNull();
       }
 }
        public void ShouldRedirectUnauthenticatedUser(Database db, [Content] DbItem item,[Substitute]AuthorizationContext filterContext, RedirectUnauthenticatedAttribute redirectUnauthenticated)
        {
            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))
              using (new Sitecore.Security.Accounts.UserSwitcher(@"extranet\John", false))
              {
            redirectUnauthenticated.OnAuthorization(filterContext);
            filterContext.Result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be("/");
              }
        }