@@ -15,8 +15,7 @@ public class MockRepositorySpecification : DispatcherSpecification
15
15
public IEventSerializer EventSerializer { get ; }
16
16
public IConfiguredConnection ConfiguredConnection { get ; }
17
17
18
- private string _schema ;
19
- public string Schema => _schema ;
18
+ public string Schema { get ; }
20
19
21
20
/// <summary>
22
21
/// Creates a mock repository.
@@ -25,7 +24,7 @@ public class MockRepositorySpecification : DispatcherSpecification
25
24
/// <param name="dataStore">Stream store connection.</param>
26
25
private MockRepositorySpecification ( string schema , IStreamStoreConnection dataStore )
27
26
{
28
- _schema = schema ;
27
+ Schema = schema ;
29
28
StreamNameBuilder = string . IsNullOrEmpty ( schema ) ? new PrefixedCamelCaseStreamNameBuilder ( ) : new PrefixedCamelCaseStreamNameBuilder ( schema ) ;
30
29
StreamStoreConnection = dataStore ;
31
30
StreamStoreConnection . Connect ( ) ;
@@ -47,17 +46,13 @@ private MockRepositorySpecification(string schema, IStreamStoreConnection dataSt
47
46
/// Creates a mock repository with a prefix.
48
47
/// </summary>
49
48
/// <param name="schema">Schema prefix for stream name. Default value is "Test".</param>
50
- public MockRepositorySpecification ( string schema = "Test" ) : this ( schema , new MockStreamStoreConnection ( schema ) )
51
- {
52
- }
49
+ public MockRepositorySpecification ( string schema = "Test" ) : this ( schema , new MockStreamStoreConnection ( schema ) ) { }
53
50
54
51
/// <summary>
55
52
/// Creates a mock repository connected to a StreamStore.
56
53
/// </summary>
57
54
/// <param name="dataStore">Stream store connection.</param>
58
- public MockRepositorySpecification ( IStreamStoreConnection dataStore ) : this ( dataStore . ConnectionName , dataStore )
59
- {
60
- }
55
+ public MockRepositorySpecification ( IStreamStoreConnection dataStore ) : this ( dataStore . ConnectionName , dataStore ) { }
61
56
62
57
public virtual void ClearQueues ( )
63
58
{
@@ -71,5 +66,19 @@ public IListener GetListener(string name) =>
71
66
StreamStoreConnection ,
72
67
StreamNameBuilder ,
73
68
EventSerializer ) ;
69
+
70
+ private bool _disposed ;
71
+ protected override void Dispose ( bool disposing )
72
+ {
73
+ if ( _disposed )
74
+ return ;
75
+ if ( disposing )
76
+ {
77
+ StreamStoreConnection . Dispose ( ) ;
78
+ RepositoryEvents . Dispose ( ) ;
79
+ }
80
+ _disposed = true ;
81
+ base . Dispose ( disposing ) ;
82
+ }
74
83
}
75
84
}
0 commit comments