public void CheckIfExistsDatabaseTask()
 {
     //Arrange
     //Act & Assert
     Assert.Throws <ETLBoxException>(() =>
     {
         IfDatabaseExistsTask.IsExisting("test");
     });
 }
        public void IfDatabaseExists(IConnectionManager connection)
        {
            //Arrange
            string dbName       = ("ETLBox_" + HashHelper.RandomString(10)).ToLower();
            var    existsBefore = IfDatabaseExistsTask.IsExisting(connection, dbName);

            //Act
            SqlTask.ExecuteNonQuery(connection, "Create DB", $"CREATE DATABASE {dbName}");
            var existsAfter = IfDatabaseExistsTask.IsExisting(connection, dbName);

            //Assert
            Assert.False(existsBefore);
            Assert.True(existsAfter);

            //Cleanup
            DropDatabaseTask.Drop(connection, dbName);
        }
Beispiel #3
0
        public void Drop(IConnectionManager connection)
        {
            //Arrange
            string dbName = "ETLBox_" + TestHashHelper.RandomString(10);

            CreateDatabaseTask.Create(connection, dbName);
            bool existsBefore = IfDatabaseExistsTask.IsExisting(connection, dbName);

            //Act
            DropDatabaseTask.Drop(connection, dbName);

            //Assert
            bool existsAfter = IfDatabaseExistsTask.IsExisting(connection, dbName);

            Assert.True(existsBefore);
            Assert.False(existsAfter);
        }
 public void NotSupportedWithSQLite()
 {
     Assert.Throws <ETLBoxNotSupportedException>(
         () => IfDatabaseExistsTask.IsExisting(Config.SQLiteConnection.ConnectionManager("ControlFlow"), "Test")
         );
 }