Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions TransactionProcessor.Aggregates.Tests/FloatAggregateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void FloatAggregate_RecordCreditPurchase_CreditPurchaseIsRecorded()
{
Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId);
aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime);
Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900);
Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900, DateTime.Now);
result.IsSuccess.ShouldBeTrue();
aggregate.NumberOfCreditPurchases.ShouldBe(1);
aggregate.TotalCostPrice.ShouldBe(900);
Expand All @@ -58,7 +58,7 @@ public void FloatAggregate_RecordCreditPurchase_FloatNotCreated_ErrorThrown()
{
Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId);

Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900);
Result result = aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900, DateTime.Now);
result.IsFailed.ShouldBeTrue();
result.Status.ShouldBe(ResultStatus.Invalid);

Expand All @@ -69,7 +69,7 @@ public void FloatAggregate_RecordCreditPurchase_MultipleCreditPurchases_AllCredi
{
Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId);
aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime);
aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900);
aggregate.RecordCreditPurchase(DateTime.Now, 1000, 900, DateTime.Now);

aggregate.NumberOfCreditPurchases.ShouldBe(1);
aggregate.TotalCostPrice.ShouldBe(900);
Expand All @@ -78,7 +78,7 @@ public void FloatAggregate_RecordCreditPurchase_MultipleCreditPurchases_AllCredi

Decimal roundedUnitCostPrice= aggregate.GetUnitCostPrice();
roundedUnitCostPrice.ShouldBe(0.900m);
aggregate.RecordCreditPurchase(DateTime.Now, 2000, 1750);
aggregate.RecordCreditPurchase(DateTime.Now, 2000, 1750, DateTime.Now);

aggregate.NumberOfCreditPurchases.ShouldBe(2);
aggregate.TotalCostPrice.ShouldBe(2650);
Expand All @@ -87,7 +87,7 @@ public void FloatAggregate_RecordCreditPurchase_MultipleCreditPurchases_AllCredi
roundedUnitCostPrice.ShouldBe(0.8833m);
aggregate.TotalCreditPurchases.ShouldBe(3000);

aggregate.RecordCreditPurchase(DateTime.Now, 20000, 16000);
aggregate.RecordCreditPurchase(DateTime.Now, 20000, 16000, DateTime.Now);

aggregate.NumberOfCreditPurchases.ShouldBe(3);
aggregate.TotalCostPrice.ShouldBe(18650);
Expand All @@ -102,10 +102,10 @@ public void FloatAggregate_RecordCreditPurchase_DuplicateCreditPurchase_ErrorThr
{
Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId);
aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime);
DateTime purchaseDateTime = DateTime.Now;
aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900);
DateTimeOffset purchaseDateTime = DateTimeOffset.Now;
aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900, DateTime.Now);

Result result = aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900);
Result result = aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900, DateTime.Now);

result.IsFailed.ShouldBeTrue();
result.Status.ShouldBe(ResultStatus.Invalid);
Expand All @@ -118,7 +118,7 @@ public void FloatAggregate_GetTotalCostPrice_TotalCostReturned()
Aggregates.FloatAggregate aggregate = Aggregates.FloatAggregate.Create(TestData.FloatAggregateId);
aggregate.CreateFloat(TestData.EstateId, TestData.FloatCreatedDateTime);
DateTime purchaseDateTime = DateTime.Now;
aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900);
aggregate.RecordCreditPurchase(purchaseDateTime, 1000, 900, DateTime.Now);

Decimal totalCost = aggregate.GetTotalCostPrice(10);

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void MerchantStatementAggregate_RecordActivityDateOnStatement_ActivityDat

MerchantStatement merchantStatement = merchantStatementAggregate.GetStatement();
merchantStatement.IsCreated.ShouldBe(merchantStatement.IsCreated);
List<(Guid merchantStatementForDateId, DateTime activityDate)>? activityDates = merchantStatement.GetActivityDates();
List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)>? activityDates = merchantStatement.GetActivityDates();
activityDates.ShouldNotBeNull();
activityDates.ShouldNotBeEmpty();
activityDates.Count.ShouldBe(1);
Expand All @@ -50,7 +50,7 @@ public void MerchantStatementAggregate_RecordActivityDateOnStatement_DuplicateAc

MerchantStatement merchantStatement = merchantStatementAggregate.GetStatement();
merchantStatement.IsCreated.ShouldBe(merchantStatement.IsCreated);
List<(Guid merchantStatementForDateId, DateTime activityDate)>? activityDates = merchantStatement.GetActivityDates();
List<(Guid merchantStatementForDateId, DateTimeOffset activityDate)>? activityDates = merchantStatement.GetActivityDates();
activityDates.ShouldNotBeNull();
activityDates.ShouldNotBeEmpty();
activityDates.Count.ShouldBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void ReconciliationAggregate_StartReconciliation_ReconciliationIsStarted(
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
result.IsSuccess.ShouldBeTrue();

reconciliationAggregate.HasBeenStarted.ShouldBeTrue();
Expand All @@ -42,11 +42,11 @@ public void ReconciliationAggregate_StartReconciliation_InvalidData_ErrorThrown(
{
ReconciliationAggregate reconciliationAggregate = ReconciliationAggregate.Create(TestData.TransactionId);

DateTime transactionDateTime = validDateTime ? TestData.TransactionDateTime : DateTime.MinValue;
DateTimeOffset transactionDateTime = validDateTime ? TestData.TransactionDateTime : DateTime.MinValue;
Guid estateId = validEstateId ? TestData.EstateId : Guid.Empty;
Guid merchantId = validMerchantId ? TestData.MerchantId : Guid.Empty;

Result result = reconciliationAggregate.StartReconciliation(transactionDateTime, estateId, merchantId);
Result result = reconciliationAggregate.StartReconciliation(transactionDateTime, estateId, merchantId, TestData.HostDateTime);
result.IsFailed.ShouldBeTrue();
result.Status.ShouldBe(ResultStatus.Invalid);
}
Expand All @@ -56,9 +56,9 @@ public void ReconciliationAggregate_StartReconciliation_ReconciliationAlreadySta
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);

Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
result.IsSuccess.ShouldBeTrue();
}

Expand All @@ -67,12 +67,12 @@ public void ReconciliationAggregate_StartReconciliation_ReconciliationAlreadyCom
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage);
reconciliationAggregate.CompleteReconciliation();

Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
Result result = reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
result.IsSuccess.ShouldBeTrue();
}

Expand All @@ -81,7 +81,7 @@ public void ReconciliationAggregate_RecordOverallTotals_OverallTotalsAreRecorded
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
Result result = reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
result.IsSuccess.ShouldBeTrue();

Expand All @@ -105,7 +105,7 @@ public void ReconciliationAggregate_RecordOverallTotals_ReconciliationAlreadyCom
{
ReconciliationAggregate reconciliationAggregate = ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage);
reconciliationAggregate.CompleteReconciliation();
Expand All @@ -121,7 +121,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationIsAuthorised()
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
Result result = reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage);
result.IsSuccess.ShouldBeTrue();
Expand All @@ -146,7 +146,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationAlreadyAuthorised_No
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage);

Expand All @@ -159,7 +159,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationAlreadyDeclined_Erro
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage);

Expand All @@ -172,7 +172,7 @@ public void ReconciliationAggregate_Authorise_ReconciliationAlreadyCompleted_Err
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage);
reconciliationAggregate.CompleteReconciliation();
Expand All @@ -186,7 +186,7 @@ public void ReconciliationAggregate_Decline_ReconciliationIsDeclined()
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
Result result = reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage);
result.IsSuccess.ShouldBeTrue();
Expand All @@ -211,7 +211,7 @@ public void ReconciliationAggregate_Decline_ReconciliationAlreadyAuthorised_Erro
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Authorise(TestData.ResponseCode, TestData.ResponseMessage);

Expand All @@ -224,7 +224,7 @@ public void ReconciliationAggregate_Decline_ReconciliationAlreadyDecline_NoError
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage);

Expand All @@ -237,7 +237,7 @@ public void ReconciliationAggregate_Decline_ReconciliationAlreadyCompleted_NoErr
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
reconciliationAggregate.Decline(TestData.ResponseCode, TestData.ResponseMessage);
reconciliationAggregate.CompleteReconciliation();
Expand All @@ -253,7 +253,7 @@ public void ReconciliationAggregate_CompleteReconciliation_ReconciliationIsCompl
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
if (isAuthorised)
{
Expand Down Expand Up @@ -286,7 +286,7 @@ public void ReconciliationAggregate_CompleteReconciliation_NotAuthorisedOrDeclin
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);

Result result = reconciliationAggregate.CompleteReconciliation();
Expand All @@ -301,7 +301,7 @@ public void ReconciliationAggregate_CompleteReconciliation_ReconciliationAlready
{
Aggregates.ReconciliationAggregate reconciliationAggregate = Aggregates.ReconciliationAggregate.Create(TestData.TransactionId);

reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId);
reconciliationAggregate.StartReconciliation(TestData.TransactionDateTime, TestData.EstateId, TestData.MerchantId, TestData.HostDateTime);
reconciliationAggregate.RecordOverallTotals(TestData.ReconciliationTransactionCount, TestData.ReconciliationTransactionValue);
if (isAuthorised)
{
Expand Down
Loading
Loading