public void RaisesExceptionForIncorrectDatabaseFileExt() { // Arrange var tempFilePath = TempFileHelpz.MakeFilePath(".bleep"); var connectionStringWithInvalidFileExt = string.Format(SQLiteHelpz.ConnectionStringMask, tempFilePath); // Act Action act = () => new SQLiteConnectionString(connectionStringWithInvalidFileExt); // Assert act.ShouldThrow <ArgumentException>().WithMessage("*database name*"); }
public void RaisesExceptionForMalformedConnectionString() { // Arrange var tempFilePath = TempFileHelpz.MakeFilePath(SQLiteHelpz.SQLiteFileExt); var malformedConnectionString = $"Data Source{tempFilePath};Version=3;"; // Act Action act = () => new SQLiteConnectionString(malformedConnectionString); // Assert act.ShouldThrow <ArgumentException>().WithMessage("*database file path*"); }
public void DatabaseNameIsExtracted() { // Arrange var tempFilePath = TempFileHelpz.MakeFilePath(SQLiteHelpz.SQLiteFileExt); var connectionString = string.Format(SQLiteHelpz.ConnectionStringMask, tempFilePath); var sut = new SQLiteConnectionString(connectionString); // Act var result = sut.DatabaseName; // Assert result.Should().Be(Path.GetFileName(tempFilePath)); }
public static string CreateTempConnectionString() { var tempFilePath = TempFileHelpz.MakeFilePath(SQLiteFileExt); return(string.Format(ConnectionStringMask, tempFilePath)); }