Esempio n. 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.");
        }
Esempio n. 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.");
        }
 public IActionResult ForbidWithAuthenticationProperties()
 {
     return(this.Forbid(TestObjectFactory.GetAuthenticationProperties()));
 }
 public IActionResult ChallengeWithAuthenticationProperties()
 {
     return(this.Challenge(TestObjectFactory.GetAuthenticationProperties()));
 }
Esempio n. 5
0
 public IActionResult SignOutWithAuthenticationProperties()
 {
     return(this.SignOut(TestObjectFactory.GetAuthenticationProperties()));
 }
Esempio n. 6
0
 public IActionResult SignInWithAuthenticationPropertiesAndScheme()
 {
     return(this.SignIn(ClaimsPrincipalBuilder.DefaultAuthenticated,
                        TestObjectFactory.GetAuthenticationProperties(),
                        AuthenticationScheme.Basic));
 }