File tree Expand file tree Collapse file tree 3 files changed +30
-5
lines changed
Expand file tree Collapse file tree 3 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using Microsoft . Data . Sqlite ;
23
34namespace SQLiteSampleApplication
45{
@@ -55,7 +56,7 @@ static void TemporaryFileDb()
5556
5657 static void PermanentFileDb ( )
5758 {
58- Microsoft . Data . Sqlite . SqliteConnection connection = new ( "Data Source=dbup.db" ) ;
59+ SqliteConnection connection = new ( "Data Source=dbup.db" ) ;
5960
6061 using ( var database = new DbUp . SQLite . Helpers . SharedConnection ( connection ) )
6162 {
Original file line number Diff line number Diff line change 1- using Microsoft . Data . Sqlite ;
2- using Shouldly ;
1+ using Shouldly ;
32using Xunit ;
43
54namespace DbUp . SQLite . Tests
65{
76 public class SQLiteSupportTests
87 {
9- static readonly string dbFilePath = Path . Combine ( Environment . CurrentDirectory , "test.db" ) ;
8+ static readonly string DbFilePath = Path . Combine ( Environment . CurrentDirectory , "test.db" ) ;
109
1110 [ Fact ]
1211 public void CanUseSQLite ( )
1312 {
14- var connectionString = $ "Data Source={ dbFilePath } ";
13+ var connectionString = $ "Data Source={ DbFilePath } ";
1514
1615 var upgrader = DeployChanges . To
1716 . SQLiteDatabase ( connectionString )
@@ -23,5 +22,28 @@ public void CanUseSQLite()
2322 result . Error . ShouldBe ( null ) ;
2423 result . Successful . ShouldBe ( true ) ;
2524 }
25+
26+ /// <summary>
27+ /// Test for https://github.com/DbUp/dbup-sqlite/issues/2
28+ /// </summary>
29+ [ Fact ]
30+ public void DoesNotExhibitSafeHandleError ( )
31+ {
32+ var connectionString = "Data source=:memory:" ;
33+
34+ var upgrader =
35+ DeployChanges . To
36+ . SQLiteDatabase ( connectionString )
37+ . WithScript ( "Script001" , @"
38+ create table test (
39+ contact_id INTEGER PRIMARY KEY
40+ );
41+ " )
42+ . LogScriptOutput ( )
43+ . LogToConsole ( )
44+ . Build ( ) ;
45+ var result = upgrader . PerformUpgrade ( ) ;
46+ result . Successful . ShouldBeTrue ( ) ;
47+ }
2648 }
2749}
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ public InMemorySQLiteDatabase()
2323 {
2424 DataSource = ":memory:" ,
2525 DefaultTimeout = 5 ,
26+ Mode = SqliteOpenMode . Memory ,
27+ ConnectionString = "PRAGMA encoding='UTF-16'; PRAGMA journal_mode='MEMORY';"
2628 } ;
2729 ConnectionString = connectionStringBuilder . ToString ( ) ;
2830
You can’t perform that action at this time.
0 commit comments