Exemplo n.º 1
0
        public void OAuthCredentials_should_set_auth_header_Test()
        {
            var credentials = new OAuthCredentials("token");
            var client = credentials.BuildHttpClient();
            client.DefaultRequestHeaders.Should().NotBeNullOrEmpty();

            var header = client.DefaultRequestHeaders.FirstOrDefault(pair => pair.Key == "Authorization");
            header.Should().NotBeNull();
            header.Value.First().Should().Contain("Bearer");
        }
Exemplo n.º 2
0
 public void OAuth_with_username_password_should_set_auth_header_Test()
 {
     var credentials = new OAuthCredentials("us3r", "p4ssw0rd", BASE_ADDRESS + "api/authentication/token");
     var client = credentials.BuildHttpClient();
     client.DefaultRequestHeaders.Should().NotBeNullOrEmpty();
     var header = client.DefaultRequestHeaders.FirstOrDefault(pair => pair.Key == "Authorization");
     header.Should().NotBeNull();
     header.Value.First().Should().Contain("Bearer");
 }