@@ -10,6 +10,8 @@ namespace TransactionProcessor.BusinessLogic.Tests.Services
1010 using BusinessLogic . Services ;
1111 using Models ;
1212 using Moq ;
13+ using Shared . DomainDrivenDesign . EventSourcing ;
14+ using Shared . EventStore . Aggregate ;
1315 using Shared . EventStore . EventStore ;
1416 using Shouldly ;
1517 using Testing ;
@@ -21,7 +23,7 @@ public class TransactionAggregateManagerTests
2123 [ Fact ]
2224 public async Task TransactionAggregateManager_AuthoriseTransaction_TransactionAuthorised ( )
2325 {
24- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
26+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
2527 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
2628 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
2729
@@ -37,7 +39,7 @@ await transactionAggregateManager.AuthoriseTransaction(TestData.EstateId,
3739 [ Fact ]
3840 public async Task TransactionAggregateManager_AuthoriseTransactionLocally_TransactionLocallyAuthorised ( )
3941 {
40- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
42+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
4143 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
4244 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
4345
@@ -51,7 +53,7 @@ await transactionAggregateManager.AuthoriseTransactionLocally(TestData.EstateId,
5153 [ Fact ]
5254 public async Task TransactionAggregateManager_DeclineTransaction_TransactionDeclined ( )
5355 {
54- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
56+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
5557 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
5658 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
5759
@@ -67,7 +69,7 @@ await transactionAggregateManager.DeclineTransaction(TestData.EstateId,
6769 [ Fact ]
6870 public async Task TransactionAggregateManager_DeclineTransactionLocally_TransactionLocallyDeclined ( )
6971 {
70- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
72+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
7173 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
7274 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
7375
@@ -80,7 +82,7 @@ await transactionAggregateManager.DeclineTransactionLocally(TestData.EstateId,
8082 [ Fact ]
8183 public async Task TransactionAggregateManager_GetAggregate_AggregateReturned ( )
8284 {
83- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
85+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
8486 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetCompletedLogonTransactionAggregate ) ;
8587 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
8688
@@ -94,7 +96,7 @@ public async Task TransactionAggregateManager_GetAggregate_AggregateReturned()
9496 [ Fact ]
9597 public async Task TransactionAggregateManager_RecordAdditionalRequestData_AdditionalRequestDataRecorded ( )
9698 {
97- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
99+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
98100 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
99101 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
100102
@@ -108,7 +110,7 @@ await transactionAggregateManager.RecordAdditionalRequestData(TestData.EstateId,
108110 [ Fact ]
109111 public async Task TransactionAggregateManager_RecordAdditionalRequestData_NullAdditionalRequestData_NoActionPerformed ( )
110112 {
111- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
113+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
112114 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
113115 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
114116
@@ -122,7 +124,7 @@ await transactionAggregateManager.RecordAdditionalRequestData(TestData.EstateId,
122124 [ Fact ]
123125 public async Task TransactionAggregateManager_RecordAdditionalRequestData_EmptyAdditionalRequestData_NoActionPerformed ( )
124126 {
125- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
127+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
126128 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
127129 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
128130
@@ -136,7 +138,7 @@ await transactionAggregateManager.RecordAdditionalRequestData(TestData.EstateId,
136138 [ Fact ]
137139 public async Task TransactionAggregateManager_RecordAdditionalResponseData_AdditionalResponseDataRecorded ( )
138140 {
139- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
141+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
140142 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
141143 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
142144
@@ -150,7 +152,7 @@ await transactionAggregateManager.RecordAdditionalResponseData(TestData.EstateId
150152 [ Fact ]
151153 public async Task TransactionAggregateManager_RecordAdditionalResponseData_NullAdditionalResponseData_NoActionPerformed ( )
152154 {
153- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
155+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
154156 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
155157 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
156158
@@ -164,7 +166,7 @@ await transactionAggregateManager.RecordAdditionalResponseData(TestData.EstateId
164166 [ Fact ]
165167 public async Task TransactionAggregateManager_RecordAdditionalResponseData_EmptyAdditionalResponseData_NoActionPerformed ( )
166168 {
167- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
169+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
168170 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
169171 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
170172
@@ -180,7 +182,7 @@ await transactionAggregateManager.RecordAdditionalResponseData(TestData.EstateId
180182 [ InlineData ( TransactionType . Sale ) ]
181183 public async Task TransactionAggregateManager_StartTransaction_TransactionStarted ( TransactionType transactionType )
182184 {
183- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
185+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
184186 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetEmptyTransactionAggregate ) ;
185187 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
186188
@@ -199,7 +201,7 @@ await transactionAggregateManager.StartTransaction(TestData.TransactionId,
199201 [ Fact ]
200202 public async Task TransactionAggregateManager_CompleteTransaction_TransactionCompleted ( )
201203 {
202- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
204+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
203205 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetLocallyAuthorisedTransactionAggregate ) ;
204206 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
205207
@@ -211,7 +213,7 @@ await transactionAggregateManager.CompleteTransaction(TestData.EstateId,
211213 [ Fact ]
212214 public async Task TransactionAggregateManager_RequestEmailReceipt_EmailRecieptRequested ( )
213215 {
214- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
216+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
215217 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetCompletedLogonTransactionAggregate ) ;
216218 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
217219
@@ -224,7 +226,7 @@ await transactionAggregateManager.RequestEmailReceipt(TestData.EstateId,
224226 [ Fact ]
225227 public async Task TransactionAggregateManager_AddProductDetails_ProductDetailsAddedToTransaction ( )
226228 {
227- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
229+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
228230 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetStartedTransactionAggregate ( ) ) ;
229231 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
230232
@@ -238,7 +240,7 @@ await transactionAggregateManager.AddProductDetails(TestData.EstateId,
238240 [ Fact ]
239241 public async Task TransactionAggregateManager_AddFee_FeeAddedToTransaction ( )
240242 {
241- Mock < IAggregateRepository < TransactionAggregate > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate > > ( ) ;
243+ Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < TransactionAggregate , DomainEventRecord . DomainEvent > > ( ) ;
242244 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetCompletedAuthorisedSaleTransactionAggregate ) ;
243245 TransactionAggregateManager transactionAggregateManager = new TransactionAggregateManager ( aggregateRepository . Object ) ;
244246
0 commit comments