Esempio n. 1
0
    public void AuthorizationHeaderShouldNotBeSetWithoutCredentials()
    {
        using var client = new TestLokiHttpClient();

        client.SetCredentials(null);

        client.Client.DefaultRequestHeaders.Authorization.ShouldBeNull();
    }
Esempio n. 2
0
    public void ProvidedHttpClientShouldBeUsed()
    {
        using var httpClient = new HttpClient();

        using var client = new TestLokiHttpClient(httpClient);

        client.Client.ShouldBe(httpClient);
    }
Esempio n. 3
0
    public void BasicAuthHeaderShouldBeCorrect()
    {
        var credentials = new LokiCredentials {
            Login = "******", Password = "******"
        };

        using var client = new TestLokiHttpClient();

        client.SetCredentials(credentials);

        var authorization = client.Client.DefaultRequestHeaders.Authorization;

        authorization.ShouldSatisfyAllConditions(
            () => authorization !.Scheme.ShouldBe("Basic"),
            () => authorization !.Parameter.ShouldBe("QmlsbHk6SGVycmluZ3Rvbg=="));
    }
Esempio n. 4
0
 public RequestsUriTests()
 {
     _client = new TestLokiHttpClient();
 }
Esempio n. 5
0
    public void HttpClientShouldBeCreatedIfNotProvider()
    {
        using var client = new TestLokiHttpClient();

        client.Client.ShouldNotBeNull();
    }
Esempio n. 6
0
 public RequestPayloadTests()
 {
     _client = new TestLokiHttpClient();
 }
Esempio n. 7
0
 public AuthTests()
 {
     _client = new TestLokiHttpClient();
 }
Esempio n. 8
0
 public LokiJsonTextFormatterRequestPayloadTests()
 {
     _client = new TestLokiHttpClient();
 }