1
1
using System ;
2
2
using ReactiveDomain . Messaging ;
3
3
using ReactiveDomain . Messaging . Bus ;
4
+ using ReactiveDomain . Testing . EventStore ;
4
5
using Xunit ;
5
6
6
7
namespace ReactiveDomain . Testing
@@ -28,7 +29,7 @@ public void can_get_repository_events()
28
29
var aggregate = new TestAggregate ( id ) ;
29
30
_fixture . Repository . Save ( aggregate ) ;
30
31
_fixture . RepositoryEvents . WaitFor < TestAggregateMessages . NewAggregate > ( TimeSpan . FromMilliseconds ( 500 ) ) ;
31
-
32
+
32
33
_fixture
33
34
. RepositoryEvents
34
35
. AssertNext < TestAggregateMessages . NewAggregate > ( e => e . AggregateId == id , "Aggregate Id Mismatch" )
@@ -37,7 +38,7 @@ public void can_get_repository_events()
37
38
38
39
[ Fact ]
39
40
public void can_clear_queues ( )
40
- {
41
+ {
41
42
var evt = new TestEvent ( ) ;
42
43
_fixture . Dispatcher . Publish ( evt ) ;
43
44
@@ -70,6 +71,28 @@ public void can_clear_queues()
70
71
. RepositoryEvents
71
72
. AssertEmpty ( ) ;
72
73
}
74
+
75
+ [ Fact ]
76
+ public void create_mock_repository_without_a_prefix ( )
77
+ {
78
+ var id = Guid . NewGuid ( ) ;
79
+ var expectedStreamName = $ "testAggregate-{ id : n} ";
80
+ var mockRepositoryWithoutPrefix = new MockRepositorySpecification ( dataStore : new MockStreamStoreConnection ( "" ) ) ;
81
+ var categoryStreamName = mockRepositoryWithoutPrefix . StreamNameBuilder . GenerateForAggregate ( typeof ( TestAggregate ) , id ) ;
82
+ Assert . Equal ( expectedStreamName , categoryStreamName ) ;
83
+ }
84
+
85
+ [ Fact ]
86
+ public void create_mock_repository_with_a_prefix ( )
87
+ {
88
+ var prefix = "iamaprefix" ;
89
+ var id = Guid . NewGuid ( ) ;
90
+ var expectedStreamName = $ "{ prefix } .testAggregate-{ id : n} ";
91
+ var mockRepositoryWithoutPrefix = new MockRepositorySpecification ( dataStore : new MockStreamStoreConnection ( prefix ) ) ;
92
+ var categoryStreamName = mockRepositoryWithoutPrefix . StreamNameBuilder . GenerateForAggregate ( typeof ( TestAggregate ) , id ) ;
93
+ Assert . Equal ( expectedStreamName , categoryStreamName ) ;
94
+ }
95
+
73
96
public CommandResponse Handle ( TestCommands . Command1 command )
74
97
{
75
98
return command . Succeed ( ) ;
0 commit comments