public async Task get_null_if_user_is_not_authenticated() { IHttpContextAccessor httpContextAccessor = new HttpContextAccessor(); var provider = new HttpContextUserProvider(httpContextAccessor); (await provider.GetUserNameAsync()).Should().BeNull(); }
public async Task get_null_for_non_authenticated_user_with_default_name_claim() { var username = "******"; var context = new DefaultHttpContext(); context.User = GetNonAuthenticatedIdentityWithDefaultName(username); var httpContextAccessor = new HttpContextAccessor(); httpContextAccessor.HttpContext = context; var provider = new HttpContextUserProvider(httpContextAccessor); (await provider.GetUserNameAsync()).Should().BeNull(); }