11using SimpleResults ;
22using TransactionProcessor . Aggregates ;
3+ using TransactionProcessor . BusinessLogic . Services ;
34using TransactionProcessor . Database . Contexts ;
45using TransactionProcessor . Database . Entities ;
56
@@ -67,8 +68,8 @@ public async Task VoucherDomainEventHandler_VoucherIssuedEvent_WithEmailAddress_
6768 Mock < ISecurityServiceClient > securityServiceClient = new Mock < ISecurityServiceClient > ( ) ;
6869 securityServiceClient . Setup ( s => s . GetToken ( It . IsAny < String > ( ) , It . IsAny < String > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( Result . Success ( TestData . TokenResponse ( ) ) ) ;
6970
70- Mock < IAggregateRepository < VoucherAggregate , DomainEvent > > voucherAggregateRepository = new Mock < IAggregateRepository < VoucherAggregate , DomainEvent > > ( ) ;
71- voucherAggregateRepository . Setup ( t => t . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) )
71+ Mock < IAggregateService > aggregateService = new ( ) ;
72+ aggregateService . Setup ( t => t . Get < VoucherAggregate > ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) )
7273 . ReturnsAsync ( Result . Success ( TestData . GetVoucherAggregateWithRecipientEmail ( ) ) ) ;
7374
7475 EstateManagementGenericContext context = await this . GetContext ( Guid . NewGuid ( ) . ToString ( "N" ) , TestDatabaseType . InMemory ) ;
@@ -98,7 +99,7 @@ public async Task VoucherDomainEventHandler_VoucherIssuedEvent_WithEmailAddress_
9899 } ) ;
99100
100101 VoucherDomainEventHandler voucherDomainEventHandler = new VoucherDomainEventHandler ( securityServiceClient . Object ,
101- voucherAggregateRepository . Object ,
102+ aggregateService . Object ,
102103 dbContextFactory . Object ,
103104 messagingServiceClient . Object ,
104105 fileSystem ) ;
@@ -116,8 +117,8 @@ public async Task VoucherDomainEventHandler_VoucherIssuedEvent_WithRecipientMobi
116117 Mock < ISecurityServiceClient > securityServiceClient = new Mock < ISecurityServiceClient > ( ) ;
117118 securityServiceClient . Setup ( s => s . GetToken ( It . IsAny < String > ( ) , It . IsAny < String > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( Result . Success ( TestData . TokenResponse ( ) ) ) ;
118119
119- Mock < IAggregateRepository < VoucherAggregate , DomainEvent > > voucherAggregateRepository = new Mock < IAggregateRepository < VoucherAggregate , DomainEvent > > ( ) ;
120- voucherAggregateRepository . Setup ( t => t . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) )
120+ Mock < IAggregateService > aggregateService = new ( ) ;
121+ aggregateService . Setup ( t => t . Get < VoucherAggregate > ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) )
121122 . ReturnsAsync ( Result . Success ( TestData . GetVoucherAggregateWithRecipientMobile ( ) ) ) ;
122123
123124 EstateManagementGenericContext context = await this . GetContext ( Guid . NewGuid ( ) . ToString ( "N" ) , TestDatabaseType . InMemory ) ;
@@ -147,7 +148,7 @@ public async Task VoucherDomainEventHandler_VoucherIssuedEvent_WithRecipientMobi
147148 } ) ;
148149
149150 VoucherDomainEventHandler voucherDomainEventHandler = new VoucherDomainEventHandler ( securityServiceClient . Object ,
150- voucherAggregateRepository . Object ,
151+ aggregateService . Object ,
151152 dbContextFactory . Object ,
152153 messagingServiceClient . Object ,
153154 fileSystem ) ;
0 commit comments