Skip to content

Commit ef080b7

Browse files
committed
Fix tests for #812
1 parent d7c608f commit ef080b7

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tests/AsyncTests.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,9 @@ public void TestExecuteScalar ()
641641
//delete
642642
conn.DeleteAllAsync<Customer>().Wait();
643643
// check...
644-
var nodatatask = conn.ExecuteScalarAsync<int> ("select Max(Id) from sqlite_master where type='table' and name='customer'");
644+
var nodatatask = conn.ExecuteScalarAsync<int> ("select Max(Id) from customer where FirstName='hfiueyf8374fhi'");
645645
task.Wait ();
646-
Assert.AreNotEqual (0, nodatatask.Result);
646+
Assert.AreEqual (0, nodatatask.Result);
647647
}
648648

649649
[Test]
@@ -753,28 +753,29 @@ public void TestAsyncTableQueryWhereOperation ()
753753
Customer customer1 = this.CreateCustomer(string.Empty, "country");
754754
conn.InsertAsync (customer1).Wait ();
755755
Customer customer2 = this.CreateCustomer("address");
756-
conn.InsertAsync(customer1).Wait();
756+
conn.InsertAsync(customer2).Wait();
757+
757758
// query...
758759
var query = conn.Table<Customer>();
759-
var task = query.ToListAsync();
760-
task.Wait ();
761-
var items = task.Result;
762760

763761
// check...
764-
var loaded = items.Where(v => v.Id == customer1.Id).First();
762+
var loaded = query.Where(v => v.Id == customer1.Id).ToListAsync().Result.First();
765763
Assert.AreEqual(customer1.Email, loaded.Email);
766764

767765
// check...
768-
var emptyaddress = items.Where(v => string.IsNullOrEmpty(v.Address)).First();
766+
var emptyaddress = query.Where(v => string.IsNullOrEmpty(v.Address)).ToListAsync ().Result.First ();
767+
Assert.True (string.IsNullOrEmpty (emptyaddress.Address));
769768
Assert.AreEqual(customer1.Email, emptyaddress.Email);
770769

771770
// check...
772-
var nullcountry = items.Where (v => string.IsNullOrEmpty (v.Country)).First ();
773-
Assert.AreEqual (customer2.Email, emptyaddress.Email);
771+
var nullcountry = query.Where (v => string.IsNullOrEmpty (v.Country)).ToListAsync ().Result.First ();
772+
Assert.True (string.IsNullOrEmpty (nullcountry.Country));
773+
Assert.AreEqual (customer2.Email, nullcountry.Email);
774774

775775
// check...
776-
var isnotnullorempty = items.Where (v => !string.IsNullOrEmpty (v.Country)).First ();
777-
Assert.AreEqual (customer1.Email, emptyaddress.Email);
776+
var isnotnullorempty = query.Where (v => !string.IsNullOrEmpty (v.Country)).ToListAsync ().Result.First ();
777+
Assert.True (!string.IsNullOrEmpty (isnotnullorempty.Country));
778+
Assert.AreEqual (customer1.Email, isnotnullorempty.Email);
778779
}
779780

780781
[Test]
@@ -956,9 +957,9 @@ public void CreateTable ()
956957

957958
var r2 = conn.CreateTableAsync<Customer> ().Result;
958959

959-
Assert.AreEqual (CreateTableResult.Migrated, r1);
960+
Assert.AreEqual (CreateTableResult.Migrated, r2);
960961

961-
Assert.AreEqual (7, trace.Count);
962+
Assert.AreEqual (4 * 3 + 1, trace.Count);
962963
}
963964

964965
[Test]

0 commit comments

Comments
 (0)