public void TestBuilder() { // init var expectedUrl = originalUrl + "transactions"; var target = new ApiDataUriBuilder(new Uri(originalUrl)); // act var result = target.GetTransactionsUri(); //assert Assert.AreEqual(expectedUrl, result.ToString()); }
public void TestBuilderWithSizeParameters() { // init var expectedUrl = originalUrl + "transactions?size=30"; var target = new ApiDataUriBuilder(new Uri(originalUrl), new ApiBuilderConfiguration { PageSize = 30 }); // act var result = target.GetTransactionsUri(); //assert Assert.AreEqual(expectedUrl, result.ToString()); }
public void TestBuilderWithEndDateParameter() { // init var expectedUrl = originalUrl + "transactions?endDate=2015-07-22T10:10:10Z"; var target = new ApiDataUriBuilder(new Uri(originalUrl), new ApiBuilderConfiguration { EndDate = new DateTime(2015, 7, 22, 10, 10, 10, 123) }); // act var result = target.GetTransactionsUri(); //assert Assert.AreEqual(expectedUrl, result.ToString()); }
private async void LoadDataAsync() { DataLodingStart(); var utcNow = DateTime.UtcNow; var todayStartDate = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, 0, 0, 0, 0); var todayEndDate = new DateTime(utcNow.Year, utcNow.Month, utcNow.Day, 23, 59, 59, 999); var apiUriBuilder = new ApiDataUriBuilder(new ApiBuilderConfiguration { StartDate = todayStartDate, CustomSettings = new Dictionary<string, string> { {"sort", "shipmentDate,asc"} }, EndDate = todayEndDate, PageSize = 100 }); var todaysTransactionUri = apiUriBuilder.GetTransactionsUri(); apiUriBuilder = new ApiDataUriBuilder(new ApiBuilderConfiguration { StartDate = todayStartDate.AddDays(-1), EndDate = todayEndDate.AddDays(-1), CustomSettings = new Dictionary<string, string> { {"sort", "shipmentDate,asc"} }, PageSize = 100 }); var yesterdaysTransactionUri = apiUriBuilder.GetTransactionsUri(); apiUriBuilder = new ApiDataUriBuilder(new ApiBuilderConfiguration { StartDate = todayStartDate.AddDays(-8), EndDate = todayEndDate.AddDays(-2), CustomSettings = new Dictionary<string, string> { {"sort", "shipmentDate,asc"} }, PageSize = 100 }); var lastWeekTransactionUri = apiUriBuilder.GetTransactionsUri(); apiUriBuilder = new ApiDataUriBuilder(new ApiBuilderConfiguration { EndDate = todayEndDate.AddDays(-2), CustomSettings = new Dictionary<string, string> { {"sort", "shipmentDate,asc"} }, PageSize = 100 }); var olderTransactionUri = apiUriBuilder.GetTransactionsUri(); TodaysTransactions = await DataRetrieval.GetTransactionsAsync(todaysTransactionUri, Token); YesterdaysTransactions = await DataRetrieval.GetTransactionsAsync(yesterdaysTransactionUri, Token); LastWeekTransactions = await DataRetrieval.GetTransactionsAsync(lastWeekTransactionUri, Token); OlderTransactions = await DataRetrieval.GetTransactionsAsync(olderTransactionUri, Token); BindData(); DataLodingEnd(); }
public void TestBuilderWithSortParameter() { // init var expectedUrl = originalUrl + "transactions?sort=CreateDate%2cDesc"; var target = new ApiDataUriBuilder(new Uri(originalUrl), new ApiBuilderConfiguration { SortField = SortField.CreateDate, SortOrder = SortOrder.Desc }); // act var result = target.GetTransactionsUri(); //assert Assert.AreEqual(expectedUrl, result.ToString()); }