public void should_add_parameter(string key, object value) { var collection = new UrlParametersCollection { { key, value } }; collection.ContainsKey(key).ShouldBeTrue(); collection[key].ShouldBe(value); }
public void should_generate_valid_query_string_for_multiple_parameter(Dictionary <string, object> parameters, string expected) { var collection = new UrlParametersCollection(parameters); var stringValue = collection.ToString(); stringValue.ShouldNotBeNull(); stringValue.ShouldBe(expected); }
public async Task <Product> GetByIdAsync(string id) { var parameters = new UrlParametersCollection() { { "merchantProductNoList", id } }; var result = await _apiClient.GetAsync <ApiResponse <ApiProduct> >("/api/v2/products", parameters); return(Map(result.Content.SingleOrDefault())); }
public void should_generate_valid_query_string_for_single_parameter(string key, object value, string expected) { var collection = new UrlParametersCollection { { key, value } }; var stringValue = collection.ToString(); stringValue.ShouldNotBeNull(); stringValue.ShouldBe(expected); }
public void should_return_casted_parameter(int intValue, double doubleValue, string stringValue) { var collection = new UrlParametersCollection { { "int", intValue }, { "double", doubleValue }, { "string", stringValue } }; collection.Get <int>("int").ShouldBe(intValue); collection.Get <double>("double").ShouldBe(doubleValue); collection.Get <string>("string").ShouldBe(stringValue); }
public void should_return_parameter(string key, object value) { var collection = new UrlParametersCollection { { key, value } }; var item1 = collection[key]; var item2 = collection.Get(key); item1.ShouldNotBeNull(); item2.ShouldNotBeNull(); item1.ShouldBe(item2); item1.ShouldBe(value); item2.ShouldBe(value); }
public async Task <IReadOnlyList <Order> > GetAllOrdersInProgressAsync() { bool hasNextPage; var pageNumber = 1; var parameters = new UrlParametersCollection { { "statuses", "IN_PROGRESS" } }; var totalResult = new List <Order>(); do { parameters["page"] = pageNumber; var result = await _apiClient.GetAsync <ApiResponse <ApiOrder> >("/api/v2/orders", parameters); var mappedResult = result.Content.Select(MapOrder); totalResult.AddRange(mappedResult); hasNextPage = result.TotalCount > result.ItemsPerPage * pageNumber; pageNumber++; } while (hasNextPage); return(totalResult); }