@@ -135,25 +135,23 @@ public void ByteArrayWhere()
135135 [ Description ( "Uses a null byte array to find a record" ) ]
136136 public void ByteArrayWhereNull ( )
137137 {
138- //Byte Arrays for comparisson
139- ByteArrayClass [ ] byteArrays = new ByteArrayClass [ ] {
140- new ByteArrayClass ( ) { bytes = new byte [ ] { 1 , 2 , 3 , 4 , 250 , 252 , 253 , 254 , 255 } } , //Range check
141- new ByteArrayClass ( ) { bytes = new byte [ ] { 0 } } , //null bytes need to be handled correctly
142- new ByteArrayClass ( ) { bytes = new byte [ ] { 0 , 0 } } ,
143- new ByteArrayClass ( ) { bytes = new byte [ ] { 0 , 1 , 0 } } ,
144- new ByteArrayClass ( ) { bytes = new byte [ ] { 1 , 0 , 1 } } ,
145- new ByteArrayClass ( ) { bytes = new byte [ ] { } } , //Empty byte array should stay empty (and not become null)
146- new ByteArrayClass ( ) { bytes = null } //Null should be supported
138+ //Byte Arrays for comparison
139+ ByteArrayClass [ ] byteArrays = {
140+ new ByteArrayClass { bytes = new byte [ ] { 1 , 2 , 3 , 4 , 250 , 252 , 253 , 254 , 255 } } , //Range check
141+ new ByteArrayClass { bytes = new byte [ ] { 0 } } , //null bytes need to be handled correctly
142+ new ByteArrayClass { bytes = new byte [ ] { } } , //Empty byte array should stay empty (and not become null)
143+ new ByteArrayClass { bytes = new byte [ ] { 0 , 0 } } ,
144+ new ByteArrayClass { bytes = new byte [ ] { 0 , 1 , 0 } } ,
145+ new ByteArrayClass { bytes = new byte [ ] { 1 , 0 , 1 } } ,
146+ new ByteArrayClass { bytes = null } //Null should be supported
147147 } ;
148148
149149 var database = new SQLiteConnection ( TestPath . CreateTemporaryDatabase ( ) ) ;
150150 database . CreateTable < ByteArrayClass > ( ) ;
151151
152- byte [ ] criterion = null ;
153-
154152 //Insert all of the ByteArrayClass
155153 int id = 0 ;
156- foreach ( ByteArrayClass b in byteArrays )
154+ foreach ( var b in byteArrays )
157155 {
158156 database . Insert ( b ) ;
159157 if ( b . bytes == null )
@@ -162,7 +160,7 @@ public void ByteArrayWhereNull()
162160 Assert . AreNotEqual ( 0 , id , "An ID wasn't set" ) ;
163161
164162 //Get it back out
165- ByteArrayClass fetchedByteArray = database . Table < ByteArrayClass > ( ) . Where ( x => x . bytes == criterion ) . First ( ) ;
163+ var fetchedByteArray = database . Table < ByteArrayClass > ( ) . FirstOrDefault ( x => x . bytes == null ) ;
166164
167165 Assert . IsNotNull ( fetchedByteArray ) ;
168166 //Check they are the same
0 commit comments