Esempio n. 1
0
            public void TestApply_AddSingleColumn_WithoutColumnList()
            {
                //add a column and make sure it is published
                DataTable dt = sourceDataUtils.testData.Tables["dbo.tblCTSchemaChange_1", "RELAY.CT_testdb"];

                dt.Clear();
                DataRow row = dt.NewRow();

                row["CscDdeID"]                  = 1;
                row["CscTableName"]              = "test1";
                row["CscEventType"]              = "Add";
                row["CscSchema"]                 = "dbo";
                row["CscColumnName"]             = "testadd";
                row["CscNewColumnName"]          = DBNull.Value;
                row["CscBaseDataType"]           = "int";
                row["CscCharacterMaximumLength"] = DBNull.Value;
                row["CscNumericPrecision"]       = DBNull.Value;
                row["CscNumericScale"]           = DBNull.Value;
                dt.Rows.Add(row);

                destDataUtils.DropTableIfExists("testdb", "test1", "dbo");
                DataTable test1 = new DataTable("dbo.test1", "SLAVE.testdb");

                test1.Columns.Add("column1", typeof(Int32));
                test1.Columns.Add("column2", typeof(Int32));
                destDataUtils.testData.Tables.Add(test1);

                slave.ApplySchemaChanges("CT_testdb", "testdb", 1);

                var expected = new DataColumn("testadd", typeof(Int32));
                var actual   = destDataUtils.testData.Tables["dbo.test1", "SLAVE.testdb"].Columns["testadd"];

                //assert.equal doesn't work for objects but this does
                Assert.True(expected.ColumnName == actual.ColumnName && expected.DataType == actual.DataType);
            }