Class ComponentBuilderAuthenticationExtensions
Contains authentication extension methods for IBaseTestBuilderWithComponentBuilder<TBuilder>.
Inheritance
System.Object
ComponentBuilderAuthenticationExtensions
Namespace:MyTested.AspNetCore.Mvc
Assembly:MyTested.AspNetCore.Mvc.Authentication.dll
Syntax
public static class ComponentBuilderAuthenticationExtensions
Methods
| Improve this Doc View SourceWithAuthenticatedUser<TBuilder>(IBaseTestBuilderWithComponentBuilder<TBuilder>)
Sets default authenticated Microsoft.AspNetCore.Http.HttpContext.User to the built component with "TestId" identifier and "TestUser" username.
Declaration
public static TBuilder WithAuthenticatedUser<TBuilder>(this IBaseTestBuilderWithComponentBuilder<TBuilder> builder)where TBuilder : IBaseTestBuilder
Parameters
Type | Name | Description |
---|---|---|
IBaseTestBuilderWithComponentBuilder<TBuilder> | builder | Instance of IBaseTestBuilderWithComponentBuilder<TBuilder> type. |
Returns
Type | Description |
---|---|
TBuilder | The same component builder. |
Type Parameters
Name | Description |
---|---|
TBuilder | Class representing ASP.NET Core MVC test builder. |
WithAuthenticatedUser<TBuilder>(IBaseTestBuilderWithComponentBuilder<TBuilder>, Action<IClaimsPrincipalBuilder>)
Sets custom authenticated Microsoft.AspNetCore.Http.HttpContext.User to the built component using the provided user builder.
Declaration
public static TBuilder WithAuthenticatedUser<TBuilder>(this IBaseTestBuilderWithComponentBuilder<TBuilder> builder, Action<IClaimsPrincipalBuilder> userBuilder)where TBuilder : IBaseTestBuilder
Parameters
Type | Name | Description |
---|---|---|
IBaseTestBuilderWithComponentBuilder<TBuilder> | builder | Instance of IBaseTestBuilderWithComponentBuilder<TBuilder> type. |
System.Action<IClaimsPrincipalBuilder> | userBuilder | Action setting the Microsoft.AspNetCore.Http.HttpContext.User by using IClaimsPrincipalBuilder. |
Returns
Type | Description |
---|---|
TBuilder | The same component builder. |
Type Parameters
Name | Description |
---|---|
TBuilder |