public void When_creating_connection_with_non_memory_connection_string()
        {
            var fileConnectionString = SQLiteConnectionStringProvider.GetFileConnectionString(new FileInfo("SomeFile.db"));

            Should.Throw <ArgumentException>(() => new SQLiteInMemoryConnection(fileConnectionString))
            .Message.ShouldBe("Not a valid SQLite memory connection-string.");
        }
 public void When_creating_connection_with_valid_connection_string_with_parameters()
 {
     using (var conn = new SQLiteFileConnection(SQLiteConnectionStringProvider.GetFileConnectionString(new FileInfo("C:\\SomeFile.db"))))
     {
         conn.ConnectionString.ShouldBe(@"data source=C:\SomeFile.db;failifmissing=False;pooling=False;binaryguid=False;datetimekind=Utc;datetimeformat=UnixEpoch;journal mode=Wal;synchronous=Off;useutf16encoding=False;read only=False;legacy format=False;page size=4096;cache size=-2000");
         conn.File.FullName.ShouldBe("C:\\SomeFile.db");
         conn.ConnectionTimeout.ShouldBe(15);
         conn.DataSource.ShouldBeNull();
         conn.Database.ShouldBe("main");
         conn.ServerVersion.ShouldBe("3.28.0");
         conn.State.ShouldBe(ConnectionState.Closed);
     }
 }
 /// <summary>
 /// Creates an instance of the <see cref="SQLiteInMemoryConnection"/>.
 /// </summary>
 public SQLiteFileConnection(FileSystemInfo fileInfo)
     : base(SQLiteConnectionStringProvider.GetFileConnectionString(fileInfo))
 {
 }
Example #4
0
 /// <summary>
 /// Creates an instance of the <see cref="SQLiteInMemoryConnection"/>.
 /// </summary>
 public SQLiteFileConnection(FileInfo dbFile)
     : base(SQLiteConnectionStringProvider.GetFileConnectionString(dbFile)) => File = dbFile;