@@ -8,8 +8,9 @@ namespace MessagingService.BusinessLogic.Tests.DomainEventHanders
88 using EmailMessageAggregate ;
99 using EventHandling ;
1010 using Moq ;
11- using Shared . EventStore . EventStore ;
1211 using System . Threading . Tasks ;
12+ using Shared . DomainDrivenDesign . EventSourcing ;
13+ using Shared . EventStore . Aggregate ;
1314 using Testing ;
1415 using Xunit ;
1516
@@ -18,7 +19,7 @@ public class EmailDomainEventHandlerTests
1819 [ Fact ]
1920 public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEvent_Delivered_EventIsHandled ( )
2021 {
21- Mock < IAggregateRepository < EmailAggregate > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate > > ( ) ;
22+ Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > ( ) ;
2223 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetSentEmailAggregate ) ;
2324 Mock < IEmailServiceProxy > emailServiceProxy = new Mock < IEmailServiceProxy > ( ) ;
2425 emailServiceProxy . Setup ( e => e . GetMessageStatus ( It . IsAny < String > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < CancellationToken > ( ) ) )
@@ -27,13 +28,13 @@ public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEve
2728 EmailDomainEventHandler emailDomainEventHandler = new EmailDomainEventHandler ( aggregateRepository . Object ,
2829 emailServiceProxy . Object ) ;
2930
30- await emailDomainEventHandler . Handle ( TestData . EmailResponseReceivedFromProviderEvent , CancellationToken . None ) ;
31+ await emailDomainEventHandler . Handle ( TestData . ResponseReceivedFromEmailProviderEvent , CancellationToken . None ) ;
3132 }
3233
3334 [ Fact ]
3435 public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEvent_Failed_EventIsHandled ( )
3536 {
36- Mock < IAggregateRepository < EmailAggregate > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate > > ( ) ;
37+ Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > ( ) ;
3738 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetSentEmailAggregate ) ;
3839 Mock < IEmailServiceProxy > emailServiceProxy = new Mock < IEmailServiceProxy > ( ) ;
3940 emailServiceProxy . Setup ( e => e . GetMessageStatus ( It . IsAny < String > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < CancellationToken > ( ) ) )
@@ -42,13 +43,13 @@ public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEve
4243 EmailDomainEventHandler emailDomainEventHandler = new EmailDomainEventHandler ( aggregateRepository . Object ,
4344 emailServiceProxy . Object ) ;
4445
45- await emailDomainEventHandler . Handle ( TestData . EmailResponseReceivedFromProviderEvent , CancellationToken . None ) ;
46+ await emailDomainEventHandler . Handle ( TestData . ResponseReceivedFromEmailProviderEvent , CancellationToken . None ) ;
4647 }
4748
4849 [ Fact ]
4950 public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEvent_Rejected_EventIsHandled ( )
5051 {
51- Mock < IAggregateRepository < EmailAggregate > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate > > ( ) ;
52+ Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > ( ) ;
5253 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetSentEmailAggregate ) ;
5354 Mock < IEmailServiceProxy > emailServiceProxy = new Mock < IEmailServiceProxy > ( ) ;
5455 emailServiceProxy . Setup ( e => e . GetMessageStatus ( It . IsAny < String > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < CancellationToken > ( ) ) )
@@ -57,13 +58,13 @@ public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEve
5758 EmailDomainEventHandler emailDomainEventHandler = new EmailDomainEventHandler ( aggregateRepository . Object ,
5859 emailServiceProxy . Object ) ;
5960
60- await emailDomainEventHandler . Handle ( TestData . EmailResponseReceivedFromProviderEvent , CancellationToken . None ) ;
61+ await emailDomainEventHandler . Handle ( TestData . ResponseReceivedFromEmailProviderEvent , CancellationToken . None ) ;
6162 }
6263
6364 [ Fact ]
6465 public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEvent_Bounced_EventIsHandled ( )
6566 {
66- Mock < IAggregateRepository < EmailAggregate > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate > > ( ) ;
67+ Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > ( ) ;
6768 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetSentEmailAggregate ) ;
6869 Mock < IEmailServiceProxy > emailServiceProxy = new Mock < IEmailServiceProxy > ( ) ;
6970 emailServiceProxy . Setup ( e => e . GetMessageStatus ( It . IsAny < String > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < CancellationToken > ( ) ) )
@@ -72,13 +73,13 @@ public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEve
7273 EmailDomainEventHandler emailDomainEventHandler = new EmailDomainEventHandler ( aggregateRepository . Object ,
7374 emailServiceProxy . Object ) ;
7475
75- await emailDomainEventHandler . Handle ( TestData . EmailResponseReceivedFromProviderEvent , CancellationToken . None ) ;
76+ await emailDomainEventHandler . Handle ( TestData . ResponseReceivedFromEmailProviderEvent , CancellationToken . None ) ;
7677 }
7778
7879 [ Fact ]
7980 public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEvent_Spam_EventIsHandled ( )
8081 {
81- Mock < IAggregateRepository < EmailAggregate > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate > > ( ) ;
82+ Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > ( ) ;
8283 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetSentEmailAggregate ) ;
8384 Mock < IEmailServiceProxy > emailServiceProxy = new Mock < IEmailServiceProxy > ( ) ;
8485 emailServiceProxy . Setup ( e => e . GetMessageStatus ( It . IsAny < String > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < CancellationToken > ( ) ) )
@@ -87,13 +88,13 @@ public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEve
8788 EmailDomainEventHandler emailDomainEventHandler = new EmailDomainEventHandler ( aggregateRepository . Object ,
8889 emailServiceProxy . Object ) ;
8990
90- await emailDomainEventHandler . Handle ( TestData . EmailResponseReceivedFromProviderEvent , CancellationToken . None ) ;
91+ await emailDomainEventHandler . Handle ( TestData . ResponseReceivedFromEmailProviderEvent , CancellationToken . None ) ;
9192 }
9293
9394 [ Fact ]
9495 public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEvent_Unknown_EventIsHandled ( )
9596 {
96- Mock < IAggregateRepository < EmailAggregate > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate > > ( ) ;
97+ Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > aggregateRepository = new Mock < IAggregateRepository < EmailAggregate , DomainEventRecord . DomainEvent > > ( ) ;
9798 aggregateRepository . Setup ( a => a . GetLatestVersion ( It . IsAny < Guid > ( ) , It . IsAny < CancellationToken > ( ) ) ) . ReturnsAsync ( TestData . GetSentEmailAggregate ) ;
9899 Mock < IEmailServiceProxy > emailServiceProxy = new Mock < IEmailServiceProxy > ( ) ;
99100 emailServiceProxy . Setup ( e => e . GetMessageStatus ( It . IsAny < String > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < DateTime > ( ) , It . IsAny < CancellationToken > ( ) ) )
@@ -102,7 +103,7 @@ public async Task EmailDomainEventHandler_Handle_ResponseReceivedFromProviderEve
102103 EmailDomainEventHandler emailDomainEventHandler = new EmailDomainEventHandler ( aggregateRepository . Object ,
103104 emailServiceProxy . Object ) ;
104105
105- await emailDomainEventHandler . Handle ( TestData . EmailResponseReceivedFromProviderEvent , CancellationToken . None ) ;
106+ await emailDomainEventHandler . Handle ( TestData . ResponseReceivedFromEmailProviderEvent , CancellationToken . None ) ;
106107 }
107108 }
108109}
0 commit comments