Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

All AsyncTests passing on Mac

  • Loading branch information...
commit 02dd39cb832f0c6f07c540ff282412a3086ed46b 1 parent 0a90ffc
@praeclarum authored
Showing with 14 additions and 90 deletions.
  1. +2 −2 SQLite.sln
  2. +7 −86 tests/AsyncTests.cs
  3. +5 −2 tests/SQLite.Tests.csproj
View
4 SQLite.sln
@@ -1,6 +1,6 @@

-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Tests", "tests\SQLite.Tests.csproj", "{6947A8F1-99BE-4DD1-AD4D-D89425CE67A2}"
EndProject
Global
View
93 tests/AsyncTests.cs
@@ -76,8 +76,8 @@ internal static SQLiteAsyncConnection GetConnection (ref string path)
#if NETFX_CORE
return new SQLiteAsyncConnection(SQLiteConnectionSpecification.CreateForAsyncMetroStyle(DatabaseName, ref path));
#else
- path = Path.Combine (Path.GetTemp, DatabaseName);
- return new SQLiteAsyncConnection (SQLiteConnectionSpecification.CreateForAsync (DatabaseName));
+ path = System.IO.Path.GetTempFileName ();
+ return new SQLiteAsyncConnection (path);
#endif
}
@@ -240,7 +240,7 @@ public void TestGetAsync ()
#else
[Test]
#endif
- public void TestGetSafeAsyncItemPresent ()
+ public void TestFindAsyncItemPresent ()
{
// create...
Customer customer = CreateCustomer ();
@@ -255,7 +255,7 @@ public void TestGetSafeAsyncItemPresent ()
Assert.AreNotEqual (0, customer.Id);
// get it back...
- var task = conn.GetSafeAsync<Customer> (customer.Id);
+ var task = conn.FindAsync<Customer> (customer.Id);
task.Wait ();
Customer loaded = task.Result;
@@ -268,14 +268,14 @@ public void TestGetSafeAsyncItemPresent ()
#else
[Test]
#endif
- public void TestGetSafeAsyncItemMissing ()
+ public void TestFindAsyncItemMissing ()
{
// connect and insert...
var conn = GetConnection ();
conn.CreateTableAsync<Customer> ().Wait ();
// now get one that doesn't exist...
- var task = conn.GetSafeAsync<Customer> (-1);
+ var task = conn.FindAsync<Customer> (-1);
task.Wait ();
// check...
@@ -320,42 +320,6 @@ public void TestQueryAsync ()
#else
[Test]
#endif
- public void TestDeferredQueryAsync ()
- {
- // connect...
- var conn = GetConnection ();
- conn.CreateTableAsync<Customer> ().Wait ();
-
- // insert some...
- List<Customer> customers = new List<Customer> ();
- for (int index = 0; index < 5; index++) {
- Customer customer = new Customer ();
- customer.FirstName = "foo";
- customer.LastName = "bar";
- customer.Email = Guid.NewGuid ().ToString ();
-
- // insert...
- conn.InsertAsync (customer).Wait ();
-
- // add...
- customers.Add (customer);
- }
-
- // return the third one...
- var task = conn.DeferredQueryAsync<Customer> ("select * from customer where id=?", customers[2].Id);
- task.Wait ();
- var loaded = task.Result.ToList ();
-
- // check...
- Assert.AreEqual (1, loaded.Count);
- Assert.AreEqual (customers[2].Email, loaded[0].Email);
- }
-
-#if NETFX_CORE
- [TestMethod]
-#else
- [Test]
-#endif
public void TestTableAsync ()
{
// connect...
@@ -380,50 +344,7 @@ public void TestTableAsync ()
// run the table operation...
var query = conn.Table<Customer> ();
- var loaded = query.ToList ();
-
- // check that we got them all back...
- Assert.AreEqual (5, loaded.Count);
- Assert.IsNotNull (loaded.Where (v => v.Id == customers[0].Id));
- Assert.IsNotNull (loaded.Where (v => v.Id == customers[1].Id));
- Assert.IsNotNull (loaded.Where (v => v.Id == customers[2].Id));
- Assert.IsNotNull (loaded.Where (v => v.Id == customers[3].Id));
- Assert.IsNotNull (loaded.Where (v => v.Id == customers[4].Id));
- }
-
-#if NETFX_CORE
- [TestMethod]
-#else
- [Test]
-#endif
- public void TestTableAsyncWithClone ()
- {
- // connect...
- var conn = GetConnection ();
- conn.CreateTableAsync<Customer> ().Wait ();
- conn.ExecuteAsync ("delete from customer").Wait ();
-
- // insert some...
- List<Customer> customers = new List<Customer> ();
- for (int index = 0; index < 5; index++) {
- Customer customer = new Customer ();
- customer.FirstName = "foo";
- customer.LastName = "bar";
- customer.Email = Guid.NewGuid ().ToString ();
-
- // insert...
- conn.InsertAsync (customer).Wait ();
-
- // add...
- customers.Add (customer);
- }
-
- // run the table operation...
- var query = conn.Table<Customer> ();
-
- // clone it...
- var cloned = query.Clone ();
- var loaded = cloned.ToList ();
+ var loaded = query.ToListAsync ().Result;
// check that we got them all back...
Assert.AreEqual (5, loaded.Count);
View
7 tests/SQLite.Tests.csproj
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -9,7 +9,6 @@
<OutputType>Library</OutputType>
<RootNamespace>SQLite.Tests</RootNamespace>
<AssemblyName>SQLite.Tests</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -53,5 +52,9 @@
<Compile Include="UnicodeTest.cs" />
<Compile Include="UniqueTest.cs" />
<Compile Include="StringQueryTest.cs" />
+ <Compile Include="AsyncTests.cs" />
+ <Compile Include="..\src\SQLiteAsync.cs">
+ <Link>SQLiteAsync.cs</Link>
+ </Compile>
</ItemGroup>
</Project>
Please sign in to comment.
Something went wrong with that request. Please try again.