@@ -15,8 +15,7 @@ public class MockRepositorySpecification : DispatcherSpecification
1515 public IEventSerializer EventSerializer { get ; }
1616 public IConfiguredConnection ConfiguredConnection { get ; }
1717
18- private string _schema ;
19- public string Schema => _schema ;
18+ public string Schema { get ; }
2019
2120 /// <summary>
2221 /// Creates a mock repository.
@@ -25,7 +24,7 @@ public class MockRepositorySpecification : DispatcherSpecification
2524 /// <param name="dataStore">Stream store connection.</param>
2625 private MockRepositorySpecification ( string schema , IStreamStoreConnection dataStore )
2726 {
28- _schema = schema ;
27+ Schema = schema ;
2928 StreamNameBuilder = string . IsNullOrEmpty ( schema ) ? new PrefixedCamelCaseStreamNameBuilder ( ) : new PrefixedCamelCaseStreamNameBuilder ( schema ) ;
3029 StreamStoreConnection = dataStore ;
3130 StreamStoreConnection . Connect ( ) ;
@@ -47,17 +46,13 @@ private MockRepositorySpecification(string schema, IStreamStoreConnection dataSt
4746 /// Creates a mock repository with a prefix.
4847 /// </summary>
4948 /// <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 ) ) { }
5350
5451 /// <summary>
5552 /// Creates a mock repository connected to a StreamStore.
5653 /// </summary>
5754 /// <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 ) { }
6156
6257 public virtual void ClearQueues ( )
6358 {
@@ -71,5 +66,19 @@ public IListener GetListener(string name) =>
7166 StreamStoreConnection ,
7267 StreamNameBuilder ,
7368 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+ }
7483 }
7584}
0 commit comments