コード例 #1
0
 public void CallHandlerWithoutProviderUsesDefaultProvider()
 {
     using (new PrincipalSwitcher(FredPrincipal))
     {
         AuthorizationTestTarget testTarget = GetTarget(AllowJackPolicySet);
         string currentPrincipalName        = testTarget.GetCurrentPrincipalName();
     }
 }
コード例 #2
0
 public void ShouldAllowJackToCallGetCurrentPrincipalName()
 {
     using (new PrincipalSwitcher(JackPrincipal))
     {
         AuthorizationTestTarget testTarget = GetTarget(AllowBasedOnTokensPolicySet);
         string currentPrincipalName        = testTarget.GetCurrentPrincipalName();
     }
 }
コード例 #3
0
 public void AuthorizationCanBeDeniedByCallHandler()
 {
     using (new PrincipalSwitcher(JackPrincipal))
     {
         AuthorizationTestTarget testTarget = GetTarget(AllowFredPolicySet);
         testTarget.GetCurrentPrincipalName();
     }
 }
コード例 #4
0
 public void ShouldNotAllowFredToCallGetCurrentPrincipalName()
 {
     using (new PrincipalSwitcher(FredPrincipal))
     {
         AuthorizationTestTarget testTarget = GetTarget(AllowBasedOnTokensPolicyContainer);
         string currentPrincipalName        = testTarget.GetCurrentPrincipalName();
     }
 }
コード例 #5
0
 public void CallHandlerDoesNothingWhenUserIsAuthorized()
 {
     using (new PrincipalSwitcher(FredPrincipal))
     {
         AuthorizationTestTarget testTarget = GetTarget(AllowFredPolicySet);
         string currentPrincipalName        = testTarget.GetCurrentPrincipalName();
         Assert.AreEqual("Fred", currentPrincipalName);
     }
 }