public void CanGetAcceptLanguageViaProperty() { var options = new RequestOptions(); options.AddHeader("Accept-Language", "tchoupitoulas"); Assert.Equal("tchoupitoulas", options.AcceptLanguage); }
public void CanAddHeaders() { var options = new RequestOptions(); options.AddHeader("Custom-Header", "tchoupitoulas"); Assert.True(options.Headers.ContainsKey("Custom-Header")); Assert.Equal("tchoupitoulas", options.Headers["Custom-Header"]); }
public void WillIncludeCustomHeaders() { var options = new RequestOptions(); options.AddHeader("Accept-Language", "en-US"); var matcher = MockClient.HeaderMatcher(new Dictionary <string, object> { { "Accept-Language", "en-US" }, }); var client = MockClient.Build(matcher, NotFoundResponse()); Assert.Throws <Recurly.Errors.NotFound>(() => client.GetResource("douglas/", "param1", new DateTime(2020, 01, 01), options)); }
public void WillAddQueryStringParameters() { var options = new RequestOptions(); options.AddHeader("Accept-Language", "en-US"); var date = new DateTime(2020, 01, 01); var paramsMatcher = MockClient.QueryParameterMatcher(new Dictionary <string, object> { { "param_1", "param1" }, { "param_2", Recurly.Utils.ISO8601(date) }, }); var client = MockClient.Build(paramsMatcher, SuccessResponse(System.Net.HttpStatusCode.OK)); MyResource resource = client.GetResource("benjamin", "param1", date, options); Assert.Equal("benjamin", resource.MyString); }
public void CanNotAddIdempotencyKey() { var options = new RequestOptions(); Assert.Throws <ArgumentException>(() => options.AddHeader("Idempotency-Key", "tchoupitoulas")); }
public void CanNotAddAuthorization() { var options = new RequestOptions(); Assert.Throws <ArgumentException>(() => options.AddHeader("Authorization", "tchoupitoulas")); }
public void CanNotAddContentType() { var options = new RequestOptions(); Assert.Throws <ArgumentException>(() => options.AddHeader("Content-Type", "tchoupitoulas")); }
public void CanNotAddUserAgent() { var options = new RequestOptions(); Assert.Throws <ArgumentException>(() => options.AddHeader("User-Agent", "tchoupitoulas")); }