diff --git a/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs b/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs index 973be5a..7c52a8a 100644 --- a/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs +++ b/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs @@ -646,10 +646,10 @@ public async Task FactTransactionsControllerController_GetMerchantsByLastDaleDat await ClearStandingData(); // Last Hour - await helper.AddMerchant("Test Estate", "Merchant 1", todaysDateTime.AddMinutes(-10)); - await helper.AddMerchant("Test Estate", "Merchant 2", todaysDateTime.AddMinutes(-10)); - await helper.AddMerchant("Test Estate", "Merchant 3", todaysDateTime.AddMinutes(-10)); - await helper.AddMerchant("Test Estate", "Merchant 4", todaysDateTime.AddMinutes(-10)); + await helper.AddMerchant("Test Estate", "Merchant 1", todaysDateTime); + await helper.AddMerchant("Test Estate", "Merchant 2", todaysDateTime); + await helper.AddMerchant("Test Estate", "Merchant 3", todaysDateTime); + await helper.AddMerchant("Test Estate", "Merchant 4", todaysDateTime); // Yesterday await helper.AddMerchant("Test Estate", "Merchant 5", todaysDateTime.AddDays(-1)); @@ -736,10 +736,10 @@ public async Task FactTransactionsControllerController_GetMerchantsTransactionKp await ClearStandingData(); // Last Hour - await helper.AddMerchant("Test Estate", "Merchant 1", todaysDateTime.AddMinutes(-10)); - await helper.AddMerchant("Test Estate", "Merchant 2", todaysDateTime.AddMinutes(-10)); - await helper.AddMerchant("Test Estate", "Merchant 3", todaysDateTime.AddMinutes(-10)); - await helper.AddMerchant("Test Estate", "Merchant 4", todaysDateTime.AddMinutes(-10)); + await helper.AddMerchant("Test Estate", "Merchant 1", todaysDateTime); + await helper.AddMerchant("Test Estate", "Merchant 2", todaysDateTime); + await helper.AddMerchant("Test Estate", "Merchant 3", todaysDateTime); + await helper.AddMerchant("Test Estate", "Merchant 4", todaysDateTime); // Yesterday await helper.AddMerchant("Test Estate", "Merchant 5", todaysDateTime.AddDays(-1)); @@ -1324,7 +1324,7 @@ public async Task FactTransactionsControllerController_TodaysFailedSales_SalesRe foreach ((Guid productId, String productName, Decimal? productValue) product in productList) { var transactionCount = transactionCounts.Single(m => m.Key == merchant.Name).Value; for (int i = 0; i < transactionCount; i++) { - Transaction transaction = await helper1.BuildTransactionX(todaysDateTime.AddHours(-1), merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); + Transaction transaction = await helper1.BuildTransactionX(todaysDateTime, merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); todaysTransactions.Add(transaction); } } @@ -1340,7 +1340,7 @@ public async Task FactTransactionsControllerController_TodaysFailedSales_SalesRe foreach ((Guid productId, String productName, Decimal? productValue) product in productList) { var transactionCount = transactionCounts.Single(m => m.Key == merchant.Name).Value; for (int i = 0; i < transactionCount; i++) { - Transaction transaction = await helper1.BuildTransactionX(comparisonDate.AddHours(-1), merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); + Transaction transaction = await helper1.BuildTransactionX(comparisonDate, merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); comparisonDateTransactions.Add(transaction); } } @@ -1870,4 +1870,4 @@ public async Task FactTransactionsController_TransactionSearch_SortingTest_Trans searchResult[1].TransactionAmount.ShouldBe(200); searchResult[2].TransactionAmount.ShouldBe(100); } - }*/ \ No newline at end of file + }*/ diff --git a/EstateReportingAPI.IntegrationTests/MerchantEndpointTests.cs b/EstateReportingAPI.IntegrationTests/MerchantEndpointTests.cs index 3740153..761aded 100644 --- a/EstateReportingAPI.IntegrationTests/MerchantEndpointTests.cs +++ b/EstateReportingAPI.IntegrationTests/MerchantEndpointTests.cs @@ -155,25 +155,19 @@ public async Task MerchantEndpoint_GetMerchantKpis_MerchantKpisReturned() await this.helper.AddMerchant("Test Estate", $"Test Merchant 1",100, now, now, ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); - await this.helper.AddMerchant("Test Estate", $"Test Merchant 2", 200, now, now.AddMinutes(-10), + await this.helper.AddMerchant("Test Estate", $"Test Merchant 2", 200, now, now, ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); - await this.helper.AddMerchant("Test Estate", $"Test Merchant 3",300, now, now.AddHours(-2), + await this.helper.AddMerchant("Test Estate", $"Test Merchant 3",300, now, now.AddDays(-1), ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); - await this.helper.AddMerchant("Test Estate", $"Test Merchant 4",400, now, now.AddHours(-3), + await this.helper.AddMerchant("Test Estate", $"Test Merchant 4",400, now, now.AddDays(-2), ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); - await this.helper.AddMerchant("Test Estate", $"Test Merchant 5",500, now, now.AddDays(-2), + await this.helper.AddMerchant("Test Estate", $"Test Merchant 5",500, now, now.AddDays(-3), ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); - await this.helper.AddMerchant("Test Estate", $"Test Merchant 6",600, now, now.AddDays(-1), - ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), - ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); - await this.helper.AddMerchant("Test Estate", $"Test Merchant 7",700, now, now.AddDays(-3), - ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), - ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); - await this.helper.AddMerchant("Test Estate", $"Test Merchant 8",800, now, now.AddDays(-10), + await this.helper.AddMerchant("Test Estate", $"Test Merchant 6",600, now, now.AddDays(-10), ("Address Line 1", $"Test Town", $"TE57 1NG", $"Region"), ("Contact 1", "1@2.com", "123456"), devices: ["123456"]); diff --git a/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs b/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs index b52eb45..cda2840 100644 --- a/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs +++ b/EstateReportingAPI.IntegrationTests/TransactionsEndpointTests.cs @@ -280,7 +280,7 @@ public async Task TransactionsEndpoint_TodaysFailedSales_SalesReturned() { var comparisonDateTransactions = new List(); //DatabaseHelper helper1 = new DatabaseHelper(context); // TODO: make counts dynamic - DateTime todaysDateTime = DateTime.Now; + DateTime todaysDateTime = DateTime.Now.Date; //todaysDateTime = todaysDateTime.AddHours(12).AddMinutes(30); Dictionary transactionCounts = new() { { "Test Merchant 1", 3 }, { "Test Merchant 2", 6 }, { "Test Merchant 3", 2 }, { "Test Merchant 4", 0 } }; @@ -293,7 +293,7 @@ public async Task TransactionsEndpoint_TodaysFailedSales_SalesReturned() { foreach ((Guid productId, String productName, Decimal? productValue, Int32 contractProductReportingId) product in productList) { var transactionCount = transactionCounts.Single(m => m.Key == merchant.Name).Value; for (int i = 0; i < transactionCount; i++) { - Transaction transaction = await this.helper.BuildTransactionX(todaysDateTime.AddHours(-1), merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); + Transaction transaction = await this.helper.BuildTransactionX(todaysDateTime, merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); todaysTransactions.Add(transaction); } } @@ -309,7 +309,7 @@ public async Task TransactionsEndpoint_TodaysFailedSales_SalesReturned() { foreach ((Guid productId, String productName, Decimal? productValue, Int32 contractProductReportingId) product in productList) { var transactionCount = transactionCounts.Single(m => m.Key == merchant.Name).Value; for (int i = 0; i < transactionCount; i++) { - Transaction transaction = await this.helper.BuildTransactionX(comparisonDate.AddHours(-1), merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); + Transaction transaction = await this.helper.BuildTransactionX(comparisonDate, merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); comparisonDateTransactions.Add(transaction); } }