示例#1
0
        public void TestAddDefaultFileGroup()
        {
            string fgName = TestHelper.RandomString(10) + "_FG";

            Assert.AreEqual(0, SqlTask.ExecuteScalar <int>("FileGroup", $"select count(*) from sys.filegroups where name = '{fgName}' and is_default = 1"));
            AddFileGroupTask.AddFileGroup(fgName, DBNameParameter, "5MB", "5MB", true);
            Assert.AreEqual(1, SqlTask.ExecuteScalar <int>("FileGroup", $"select count(*) from sys.filegroups where name = '{fgName}' and is_default = 1"));
            Assert.AreEqual(1, SqlTask.ExecuteScalar <int>("FileGroup", $"select count(*) from sys.sysfiles  where name = '{fgName}'"));
        }
示例#2
0
        public void AddDefaultFileGroup()
        {
            //Arrange
            string fgName = HashHelper.RandomString(10) + "_FG";

            Assert.Equal(0, RowCountTask.Count(Connection, "sys.filegroups", $"name = '{fgName}' AND is_default = 1"));

            //Act
            AddFileGroupTask.AddFileGroup(Connection, fgName, DBName, "5MB", "5MB", true);

            //Assert
            Assert.Equal(1, RowCountTask.Count(Connection, "sys.filegroups", $"name = '{fgName}' AND is_default = 1"));
            Assert.Equal(1, RowCountTask.Count(Connection, "sys.sysfiles", $"name = '{fgName}'"));
        }
示例#3
0
        public void Start()
        {
            //Basics
            ControlFlow.CurrentDbConnection = new SqlConnectionManager(new ConnectionString("Data Source=.;Integrated Security=SSPI;"));
            DropDatabaseTask.Drop("DemoDB");
            CreateDatabaseTask.Create("DemoDB");

            ControlFlow.CurrentDbConnection = new SqlConnectionManager(new ConnectionString("Data Source=.;Integrated Security=SSPI;Initial Catalog=DemoDB;"));
            CreateSchemaTask.Create("demo");
            CreateTableTask.Create("demo.table1", new List <TableColumn>()
            {
                new TableColumn(name: "key", dataType: "int", allowNulls: false, isPrimaryKey: true, isIdentity: true),
                new TableColumn(name: "value", dataType: "nvarchar(100)", allowNulls: true)
            });

            SqlTask.ExecuteNonQuery("Insert data",
                                    $@"insert into demo.table1 (value) select * from (values ('Ein Text'), ('Noch mehr Text')) as data(v)");

            int count = RowCountTask.Count("demo.table1").Value;

            Debug.WriteLine($"Found {count} entries in demo table!");

            //Truncate:
            //TruncateTableTask.Truncate("demo.table1");

            //Batch processing / Go keyword:

            //SqlTask.ExecuteNonQuery("sql with go keyword", @"insert into demo.table1 (value) select '####';
            //go 2");

            ControlFlow.CurrentDbConnection = new SMOConnectionManager(new ConnectionString("Data Source=.;Integrated Security=SSPI;Initial Catalog=DemoDB;"));
            SqlTask.ExecuteNonQuery("sql with go keyword", @"insert into demo.table1 (value) select '####';
            go 2");

            AddFileGroupTask.AddFileGroup("FGName", "DemoDB", "200MB", "10MB", isDefaultFileGroup: true);

            CRUDProcedureTask.CreateOrAlter("demo.proc1", "select 1 as test");
        }
示例#4
0
 public void NotSupportedWithOtherDBs()
 {
     Assert.Throws <ETLBoxNotSupportedException>(
         () => AddFileGroupTask.AddFileGroup(Config.SQLiteConnection.ConnectionManager("ControlFlow"), "Test", "Test", "5MB", "5MB", true)
         );
 }
示例#5
0
 public void NotSupportedWithSQLite()
 {
     Assert.Throws <ETLBoxNotSupportedException>(
         () => AddFileGroupTask.AddFileGroup(SQLiteConnection, "Test", "Test", "5MB", "5MB", true)
         );
 }