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."); }
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())); }
public IActionResult SignOutWithAuthenticationProperties() { return(this.SignOut(TestObjectFactory.GetAuthenticationProperties())); }
public IActionResult SignInWithAuthenticationPropertiesAndScheme() { return(this.SignIn(ClaimsPrincipalBuilder.DefaultAuthenticated, TestObjectFactory.GetAuthenticationProperties(), AuthenticationScheme.Basic)); }