@@ -16,7 +16,6 @@ namespace EstateManagement.BusinessLogic.Tests.Manager
1616 using Models . Merchant ;
1717 using Moq ;
1818 using Repository ;
19- using Shared . DomainDrivenDesign . EventStore ;
2019 using Shared . EventStore . EventStore ;
2120 using Shared . Exceptions ;
2221 using Shouldly ;
@@ -25,30 +24,27 @@ namespace EstateManagement.BusinessLogic.Tests.Manager
2524
2625 public class EstateManagementManagerTests
2726 {
28- private readonly Mock < IAggregateRepositoryManager > AggregateRepositoryManager ;
2927 private readonly Mock < IAggregateRepository < EstateAggregate > > EstateAggregateRepository ;
3028 private readonly Mock < IAggregateRepository < MerchantAggregate > > MerchantAggregateRepository ;
3129 private readonly Mock < IEstateManagementRepository > EstateManagementRepository ;
32- private readonly Mock < IEventStoreContextManager > EventStoreContextManager ;
30+ private readonly Mock < IEventStoreContext > EventStoreContext ;
3331 private readonly Mock < IModelFactory > ModelFactory ;
3432
3533 private readonly EstateManagementManager EstateManagementManager ;
3634
3735 public EstateManagementManagerTests ( )
3836 {
39- Mock < IAggregateRepositoryManager > aggregateRepositoryManager = new Mock < IAggregateRepositoryManager > ( ) ;
4037 this . EstateAggregateRepository = new Mock < IAggregateRepository < EstateAggregate > > ( ) ;
4138 this . MerchantAggregateRepository = new Mock < IAggregateRepository < MerchantAggregate > > ( ) ;
4239 this . EstateManagementRepository = new Mock < IEstateManagementRepository > ( ) ;
43- this . EventStoreContextManager = new Mock < IEventStoreContextManager > ( ) ;
40+ this . EventStoreContext = new Mock < IEventStoreContext > ( ) ;
4441
4542 this . ModelFactory = new Mock < IModelFactory > ( ) ;
46-
47- aggregateRepositoryManager . Setup ( x => x . GetAggregateRepository < EstateAggregate > ( It . IsAny < Guid > ( ) ) ) . Returns ( this . EstateAggregateRepository . Object ) ;
48- aggregateRepositoryManager . Setup ( x => x . GetAggregateRepository < MerchantAggregate > ( It . IsAny < Guid > ( ) ) ) . Returns ( this . MerchantAggregateRepository . Object ) ;
49-
43+
5044 this . EstateManagementManager =
51- new EstateManagementManager ( aggregateRepositoryManager . Object , this . EstateManagementRepository . Object , this . EventStoreContextManager . Object , this . ModelFactory . Object ) ;
45+ new EstateManagementManager ( this . EstateAggregateRepository . Object ,
46+ this . MerchantAggregateRepository . Object ,
47+ this . EstateManagementRepository . Object , this . EventStoreContext . Object , this . ModelFactory . Object ) ;
5248 }
5349
5450 [ Fact ]
@@ -121,12 +117,9 @@ public async Task EstateManagementManager_GetMerchant_WithContact_MerchantIsRetu
121117 [ Fact ]
122118 public async Task EstateManagementManager_GetMerchantBalance_MerchantBalanceIsReturned ( )
123119 {
124- Mock < IEventStoreContext > eventStoreContext = new Mock < IEventStoreContext > ( ) ;
125-
126120 String projectionState = "{\r \n \" merchants\" : {\r \n \" " + $ "{ TestData . MerchantId } " + "\" : {\r \n \" MerchantId\" : \" b3054488-ccfc-4bfe-9b0c-ad7ac10b16e8\" ,\r \n \" MerchantName\" : \" Test Merchant 2\" ,\r \n \" AvailableBalance\" : 1000.00,\r \n \" Balance\" : 1000.00,\r \n \" LastDepositDateTime\" : null,\r \n \" LastSaleDateTime\" : null,\r \n \" PendingBalanceUpdates\" : []\r \n }\r \n },\r \n \" debug\" : []\r \n }" ;
127121
128- eventStoreContext . Setup ( e => e . GetPartitionStateFromProjection ( It . IsAny < String > ( ) , It . IsAny < String > ( ) ) ) . ReturnsAsync ( projectionState ) ;
129- this . EventStoreContextManager . Setup ( m => m . GetEventStoreContext ( It . IsAny < String > ( ) ) ) . Returns ( eventStoreContext . Object ) ;
122+ this . EventStoreContext . Setup ( e => e . GetPartitionStateFromProjection ( It . IsAny < String > ( ) , It . IsAny < String > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( projectionState ) ;
130123
131124 var merchantBalanceModel = await this . EstateManagementManager . GetMerchantBalance ( TestData . EstateId , TestData . MerchantId , CancellationToken . None ) ;
132125
0 commit comments