File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ public void Init()
28
28
Directory . CreateDirectory ( _path ) ;
29
29
30
30
_env = new LightningEnvironment ( _path , EnvironmentOpenFlags . None ) ;
31
+ _env . MaxDatabases = 2 ;
31
32
_env . Open ( ) ;
32
33
33
34
_txn = _env . BeginTransaction ( ) ;
@@ -148,5 +149,27 @@ public void TryGetShouldReturnValueIfKeyExists()
148
149
Assert . IsTrue ( exists ) ;
149
150
Assert . AreEqual ( value , persistedValue ) ;
150
151
}
152
+
153
+ [ Test ]
154
+ [ TestCase ( null ) ]
155
+ [ TestCase ( "test" ) ]
156
+ public void CanCommitTransactionToNamedDatabase ( string dbName )
157
+ {
158
+ using ( var db = _txn . OpenDatabase ( dbName , DatabaseOpenFlags . Create ) )
159
+ {
160
+ _txn . Put ( db , "key1" , "value" ) ;
161
+
162
+ _txn . Commit ( ) ;
163
+ }
164
+
165
+ using ( var txn2 = _env . BeginTransaction ( ) )
166
+ {
167
+ using ( var db = txn2 . OpenDatabase ( dbName ) )
168
+ {
169
+ var value = txn2 . Get < string , string > ( db , "key1" ) ;
170
+ Assert . AreEqual ( "value" , value ) ;
171
+ }
172
+ }
173
+ }
151
174
}
152
175
}
You can’t perform that action at this time.
0 commit comments