示例#1
0
        internal static HttpClient CreateAdminUser <T>(this WebApplicationFactory <T> factory) where T : class
        {
            var client = factory.DefaultApiClient();

            var jsonCredentials = JsonSerializer.Serialize(new TestAuthHandler.Credentials
            {
                Id      = NextId().ToString(),
                IsAdmin = true
            });

            client.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue(TestAuthHandler.TestScheme, jsonCredentials);

            return(client);
        }
示例#2
0
 internal static HttpClient CreateAnonymous <T>(this WebApplicationFactory <T> factory) where T : class
 => factory.DefaultApiClient();