コード例 #1
0
        public void ShouldReturnForbidShouldThrowExceptionWithInvalidAuthenticationProperties()
        {
            Test.AssertException <ForbidResultAssertionException>(
                () =>
            {
                var authenticationProperties = TestObjectFactory.GetAuthenticationProperties();

                authenticationProperties.AllowRefresh = false;

                MyController <MvcController>
                .Instance()
                .Calling(c => c.ForbidWithAuthenticationProperties())
                .ShouldReturn()
                .Forbid()
                .WithAuthenticationProperties(authenticationProperties);
            },
                "When calling ForbidWithAuthenticationProperties action in MvcController expected forbid result authentication properties to be the same as the provided one, but instead received different result.");
        }
コード例 #2
0
        public void ShouldReturnSignInShouldThrowExceptionWithInvalidAuthenticationProperties()
        {
            Test.AssertException <SignInResultAssertionException>(
                () =>
            {
                var authenticationProperties = TestObjectFactory.GetAuthenticationProperties();

                authenticationProperties.AllowRefresh = false;

                MyController <MvcController>
                .Instance()
                .Calling(c => c.SignInWithAuthenticationPropertiesAndScheme())
                .ShouldReturn()
                .SignIn(signIn => signIn
                        .WithAuthenticationProperties(authenticationProperties));
            },
                $"When calling SignInWithAuthenticationPropertiesAndScheme action in MvcController expected sign in result authentication properties to be the same as the provided one, but instead received different result.");
        }
コード例 #3
0
 public IActionResult ForbidWithAuthenticationProperties()
 {
     return(this.Forbid(TestObjectFactory.GetAuthenticationProperties()));
 }
コード例 #4
0
 public IActionResult ChallengeWithAuthenticationProperties()
 {
     return(this.Challenge(TestObjectFactory.GetAuthenticationProperties()));
 }
コード例 #5
0
 public IActionResult SignOutWithAuthenticationProperties()
 {
     return(this.SignOut(TestObjectFactory.GetAuthenticationProperties()));
 }
コード例 #6
0
 public IActionResult SignInWithAuthenticationPropertiesAndScheme()
 {
     return(this.SignIn(ClaimsPrincipalBuilder.DefaultAuthenticated,
                        TestObjectFactory.GetAuthenticationProperties(),
                        AuthenticationScheme.Basic));
 }