Exemplo n.º 1
0
        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*");
        }
Exemplo n.º 2
0
        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*");
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        public static string CreateTempConnectionString()
        {
            var tempFilePath = TempFileHelpz.MakeFilePath(SQLiteFileExt);

            return(string.Format(ConnectionStringMask, tempFilePath));
        }