File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -602,6 +602,8 @@ public void TestRead()
602602 [ Test ]
603603 public void TestDispose ( )
604604 {
605+ Stream notDisposedStream ;
606+
605607 using ( var db = SQLite3 . Open ( ":memory:" ) )
606608 {
607609 db . Execute ( "CREATE TABLE foo (x blob);" ) ;
@@ -621,7 +623,15 @@ public void TestDispose()
621623 Assert . Throws < ObjectDisposedException > ( ( ) => { blob . Read ( new byte [ 10 ] , 0 , 2 ) ; } ) ;
622624 Assert . Throws < ObjectDisposedException > ( ( ) => { blob . Write ( new byte [ 10 ] , 0 , 1 ) ; } ) ;
623625 Assert . Throws < ObjectDisposedException > ( ( ) => { blob . Seek ( 0 , SeekOrigin . Begin ) ; } ) ;
626+
627+ notDisposedStream =
628+ db . Query ( "SELECT rowid, x FROM foo;" )
629+ . Select ( row => db . OpenBlob ( row [ 1 ] . ColumnInfo , row [ 0 ] . ToInt64 ( ) , false ) )
630+ . First ( ) ;
624631 }
632+
633+ // Test that disposing the connection disposes the stream
634+ Assert . Throws < ObjectDisposedException > ( ( ) => { var x = notDisposedStream . Length ; } ) ;
625635 }
626636
627637 [ Test ]
You can’t perform that action at this time.
0 commit comments