@@ -17,6 +17,7 @@ limitations under the License.
1717
1818using NUnit . Framework ;
1919using System ;
20+ using System . Collections ;
2021using System . Collections . Generic ;
2122using System . IO ;
2223using System . Linq ;
@@ -130,6 +131,21 @@ public void TestBackup()
130131 [ TestFixture ]
131132 public class StatementTests
132133 {
134+ [ Test ]
135+ public void TestCurrent ( )
136+ {
137+ using ( var db = SQLite3 . Open ( ":memory:" ) )
138+ using ( var stmt = db . PrepareStatement ( "SELECT 1" ) )
139+ {
140+ stmt . MoveNext ( ) ;
141+ Assert . AreEqual ( stmt . Current [ 0 ] . ToInt ( ) , 1 ) ;
142+
143+ var ienumCurrent = ( ( IEnumerator ) stmt ) . Current ;
144+ var ienumResultSet = ( IReadOnlyList < IResultSetValue > ) ienumCurrent ;
145+ Assert . AreEqual ( ienumResultSet [ 0 ] . ToInt ( ) , 1 ) ;
146+ }
147+ }
148+
133149 [ Test ]
134150 public void TestDispose ( )
135151 {
@@ -150,6 +166,7 @@ public void TestDispose()
150166 Assert . Throws < ObjectDisposedException > ( ( ) => { stmt . ClearBindings ( ) ; } ) ;
151167 Assert . Throws < ObjectDisposedException > ( ( ) => { stmt . MoveNext ( ) ; } ) ;
152168 Assert . Throws < ObjectDisposedException > ( ( ) => { stmt . Reset ( ) ; } ) ;
169+ Assert . Throws < ObjectDisposedException > ( ( ) => { stmt . Status ( StatementStatusCode . Sort , false ) ; } ) ;
153170 }
154171 }
155172
@@ -286,6 +303,8 @@ public void TestGetBindParameters()
286303 Assert . Throws < KeyNotFoundException > ( ( ) => { var x = stmt . BindParameters [ ":nope" ] ; } ) ;
287304 Assert . Throws < ArgumentOutOfRangeException > ( ( ) => { var x = stmt . BindParameters [ - 1 ] ; } ) ;
288305 Assert . Throws < ArgumentOutOfRangeException > ( ( ) => { var x = stmt . BindParameters [ 100 ] ; } ) ;
306+
307+ Assert . NotNull ( ( ( IEnumerable ) stmt . BindParameters ) . GetEnumerator ( ) ) ;
289308 }
290309 }
291310 }
@@ -386,6 +405,24 @@ public void TestStatus()
386405 [ TestFixture ]
387406 public class BindParameters
388407 {
408+ [ Test ]
409+ public void TestBindOnDisposedStatement ( )
410+ {
411+ using ( var db = SQLite3 . Open ( ":memory:" ) )
412+ {
413+ db . Execute ( "CREATE TABLE foo (v int);" ) ;
414+
415+ IReadOnlyOrderedDictionary < string , IBindParameter > bindParams ;
416+
417+ using ( var stmt = db . PrepareStatement ( "INSERT INTO foo (v) VALUES (?)" ) )
418+ {
419+ bindParams = stmt . BindParameters ;
420+ }
421+
422+ Assert . Throws < ObjectDisposedException > ( ( ) => { var x = bindParams [ 0 ] ; } ) ;
423+ }
424+ }
425+
389426 [ Test ]
390427 public void TestBindObject ( )
391428 {
0 commit comments