Exemple #1
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.ForbidResult"/>
 /// with the same authentication schemes and properties as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="properties">Expected authentication properties.</param>
 /// <param name="authenticationSchemes">Expected authentication schemes.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder Forbid <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     AuthenticationProperties properties,
     params string[] authenticationSchemes)
 => shouldReturnTestBuilder
 .Forbid(result => result
         .WithAuthenticationProperties(properties)
         .ContainingAuthenticationSchemes(authenticationSchemes));
Exemple #2
0
 /// <summary>
 /// Tests whether the action result is <see cref="Microsoft.AspNetCore.Mvc.ForbidResult"/>
 /// with the same authentication properties as the provided ones.
 /// </summary>
 /// <typeparam name="TActionResult">Type of the action result.</typeparam>
 /// <param name="shouldReturnTestBuilder">Instance of <see cref="IShouldReturnTestBuilder{TActionResult}"/> type.</param>
 /// <param name="properties">Expected authentication properties.</param>
 /// <returns>Test builder of <see cref="IAndTestBuilder"/> type.</returns>
 public static IAndTestBuilder Forbid <TActionResult>(
     this IShouldReturnTestBuilder <TActionResult> shouldReturnTestBuilder,
     AuthenticationProperties properties)
 => shouldReturnTestBuilder
 .Forbid(result => result
         .WithAuthenticationProperties(properties));