public void CreatesWorkingDatabases() { // Arrange var sut = SQLiteHelpz.CreateDatabase("test"); // Act Action act = () => sut.Execute("CREATE TABLE [test] ([Id] [INTEGER] PRIMARY KEY ASC)"); // Assert act.ShouldNotThrow <Exception>(); }
public void CreatesValidConnectionString() { // Arrange var sut = SQLiteHelpz.CreateLabeledConnectionString("testdb"); // Act // Assert sut.DatabaseFilePath.Should().EndWith("-testdb.sqlite"); Directory.Exists(Path.GetDirectoryName(sut.DatabaseFilePath)) .Should() .BeTrue(); }
public void DisposesOfDatabaseFileIfRequiredTo() { var databaseFilePath = string.Empty; // Arrange using (var sut = new SQLiteDatabase(SQLiteHelpz.CreateLabeledConnectionString("testdb"))) { // Act databaseFilePath = sut.ConnectionString.DatabaseFilePath; File.Exists(databaseFilePath) .Should() .BeTrue("the database file should be created by SQLiteDatabase"); }; // Aassert File.Exists(databaseFilePath) .Should() .BeFalse("the database file should be deleted"); }