Permalink
Browse files

Getting the Metro tests in place. Not working due to missing DLL

  • Loading branch information...
1 parent bbe299d commit f15e9cc43fd3e424598a4b2b01f57d55d203e4ff @praeclarum committed May 24, 2012
View
@@ -7,4 +7,4 @@ _Resharper*
obj
bin
tests/test-results
-
+tests/TestResults/
View
@@ -3,11 +3,14 @@
using System.Linq;
using System.Text;
using System.Threading;
+using System.Threading.Tasks;
using System.IO;
#if NETFX_CORE
using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Windows.UI.Xaml.Shapes;
+using SetUp = Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute;
+using TestFixture = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
+using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
#else
using NUnit.Framework;
#endif
@@ -35,20 +38,12 @@ public class Customer
/// <summary>
/// Defines tests that exercise async behaviour.
/// </summary>
-#if NETFX_CORE
- [TestClass]
-#else
[TestFixture]
-#endif
public class AsyncTests
{
private const string DatabaseName = "async.db";
- #if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void StressAsync ()
{
string path = null;
@@ -61,7 +56,7 @@ public void StressAsync ()
var n = 500;
var errors = new List<string> ();
for (var i = 0; i < n; i++) {
- ThreadPool.QueueUserWorkItem (delegate {
+ Task.Factory.StartNew (delegate {
try {
var conn = GetConnection ();
var obj = new Customer {
@@ -134,15 +129,21 @@ SQLiteAsyncConnection GetConnection ()
[SetUp]
public void SetUp()
{
+ SQLite.SQLiteConnectionPool.Shared.Reset ();
#if NETFX_CORE
_connectionString = DatabaseName;
- _path = _connectionString;
+ _path = Path.Combine (Windows.Storage.ApplicationData.Current.LocalFolder.Path, DatabaseName);
+ try {
+ var f = Windows.Storage.StorageFile.GetFileFromPathAsync (_path).AsTask ().Result;
+ f.DeleteAsync ().AsTask ().Wait ();
+ }
+ catch (Exception) {
+ }
#else
_connectionString = Path.Combine (Path.GetTempPath (), DatabaseName);
_path = _connectionString;
-#endif
- SQLite.SQLiteConnectionPool.Shared.Reset ();
System.IO.File.Delete (_path);
+#endif
}
SQLiteAsyncConnection GetConnection (ref string path)
@@ -151,11 +152,7 @@ SQLiteAsyncConnection GetConnection (ref string path)
return new SQLiteAsyncConnection (_connectionString);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestDropTableAsync ()
{
string path = null;
@@ -183,11 +180,7 @@ private Customer CreateCustomer ()
return customer;
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestInsertAsync ()
{
// create...
@@ -212,11 +205,7 @@ public void TestInsertAsync ()
}
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestUpdateAsync ()
{
// create...
@@ -245,11 +234,7 @@ public void TestUpdateAsync ()
}
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestDeleteAsync ()
{
// create...
@@ -274,11 +259,7 @@ public void TestDeleteAsync ()
}
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestGetAsync ()
{
// create...
@@ -305,11 +286,7 @@ public void TestGetAsync ()
Assert.AreEqual (customer.Id, loaded.Id);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestFindAsyncItemPresent ()
{
// create...
@@ -333,11 +310,7 @@ public void TestFindAsyncItemPresent ()
Assert.AreEqual (customer.Id, loaded.Id);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestFindAsyncItemMissing ()
{
// connect and insert...
@@ -352,11 +325,7 @@ public void TestFindAsyncItemMissing ()
Assert.IsNull (task.Result);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestQueryAsync ()
{
// connect...
@@ -385,11 +354,7 @@ public void TestQueryAsync ()
Assert.AreEqual (customers[2].Email, loaded[0].Email);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestTableAsync ()
{
// connect...
@@ -425,11 +390,7 @@ public void TestTableAsync ()
Assert.IsNotNull (loaded.Where (v => v.Id == customers[4].Id));
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestExecuteAsync ()
{
// connect...
@@ -450,11 +411,7 @@ public void TestExecuteAsync ()
}
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestInsertAllAsync ()
{
// create a bunch of customers...
@@ -485,11 +442,7 @@ public void TestInsertAllAsync ()
}
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestRunInTransactionAsync ()
{
// connect...
@@ -519,11 +472,7 @@ public void TestRunInTransactionAsync ()
}
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestExecuteScalar ()
{
// connect...
@@ -537,11 +486,7 @@ public void TestExecuteScalar ()
Assert.AreNotEqual ("Customer", name);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableQueryToListAsync ()
{
var conn = GetConnection ();
@@ -562,11 +507,7 @@ public void TestAsyncTableQueryToListAsync ()
Assert.AreEqual (customer.Email, loaded.Email);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableQueryWhereOperation ()
{
var conn = GetConnection ();
@@ -587,11 +528,7 @@ public void TestAsyncTableQueryWhereOperation ()
Assert.AreEqual (customer.Email, loaded.Email);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableQueryCountAsync ()
{
var conn = GetConnection ();
@@ -611,11 +548,7 @@ public void TestAsyncTableQueryCountAsync ()
Assert.AreEqual (10, task.Result);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableOrderBy ()
{
var conn = GetConnection ();
@@ -636,11 +569,7 @@ public void TestAsyncTableOrderBy ()
Assert.AreEqual (-1, string.Compare (items[0].Email, items[9].Email));
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableOrderByDescending ()
{
var conn = GetConnection ();
@@ -661,11 +590,7 @@ public void TestAsyncTableOrderByDescending ()
Assert.AreEqual (1, string.Compare (items[0].Email, items[9].Email));
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableQueryTake ()
{
var conn = GetConnection ();
@@ -690,11 +615,7 @@ public void TestAsyncTableQueryTake ()
Assert.AreEqual ("0", items[0].FirstName);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableQuerySkip ()
{
var conn = GetConnection ();
@@ -719,11 +640,7 @@ public void TestAsyncTableQuerySkip ()
Assert.AreEqual ("5", items[0].FirstName);
}
-#if NETFX_CORE
- [TestMethod]
-#else
[Test]
-#endif
public void TestAsyncTableElementAtAsync ()
{
var conn = GetConnection ();
View
@@ -0,0 +1,46 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 11
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteMetroTests", "SQLiteMetroTests\SQLiteMetroTests.csproj", "{909DE315-2F55-4A20-A9AD-460D4B2A3908}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|ARM = Release|ARM
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|ARM.ActiveCfg = Debug|ARM
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|ARM.Build.0 = Debug|ARM
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|ARM.Deploy.0 = Debug|ARM
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|x64.ActiveCfg = Debug|x64
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|x64.Build.0 = Debug|x64
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|x64.Deploy.0 = Debug|x64
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|x86.ActiveCfg = Debug|x86
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|x86.Build.0 = Debug|x86
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Debug|x86.Deploy.0 = Debug|x86
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|ARM.ActiveCfg = Release|ARM
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|ARM.Build.0 = Release|ARM
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|ARM.Deploy.0 = Release|ARM
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|Any CPU.Build.0 = Release|Any CPU
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|x64.ActiveCfg = Release|x64
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|x64.Build.0 = Release|x64
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|x64.Deploy.0 = Release|x64
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|x86.ActiveCfg = Release|x86
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|x86.Build.0 = Release|x86
+ {909DE315-2F55-4A20-A9AD-460D4B2A3908}.Release|x86.Deploy.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit f15e9cc

Please sign in to comment.