Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1059 from inforithmics/FastColumnArgumentException
Fix for issue "1.8.0-beta - System.ArgumentException: method arguments are incompatible" and Unit Tests
- Loading branch information
Showing
2 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Linq; | ||
using System.Text; | ||
using SQLite; | ||
using System.Threading.Tasks; | ||
using System.IO; | ||
|
||
#if NETFX_CORE | ||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; | ||
using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute; | ||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute; | ||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute; | ||
#else | ||
using NUnit.Framework; | ||
#endif | ||
|
||
namespace SQLite.Tests | ||
{ | ||
[TestFixture] | ||
public class DbCommandTest | ||
{ | ||
[Test] | ||
public void QueryCommand() | ||
{ | ||
var db = new SQLiteConnection (Path.GetTempFileName(), true); | ||
db.CreateTable<Product>(); | ||
var b = new Product(); | ||
db.Insert(b); | ||
|
||
var test = db.CreateCommand("select * from Product") | ||
.ExecuteDeferredQuery<Product>(new TableMapping(typeof(Product))).ToList(); | ||
|
||
|
||
Assert.AreEqual (test.Count, 1); | ||
} | ||
|
||
#region Issue #1048 | ||
|
||
[Test] | ||
public void QueryCommandCastToObject() | ||
{ | ||
var db = new SQLiteConnection (Path.GetTempFileName(), true); | ||
db.CreateTable<Product>(); | ||
var b = new Product(); | ||
db.Insert(b); | ||
|
||
var test = db.CreateCommand("select * from Product") | ||
.ExecuteDeferredQuery<object>(new TableMapping(typeof(Product))).ToList(); | ||
|
||
|
||
Assert.AreEqual (test.Count, 1); | ||
} | ||
|
||
#endregion | ||
} | ||
} |