示例#1
0
        public void ShouldRemoveRowGuidColFromColumnWhenMergingRemoveRowGuidColumnOperation()
        {
            var columns = new Column[]
            {
                Column.UniqueIdentifier("name", true, Nullable.NotNull, "default expression", "default constraint name", "description"),
                Column.UniqueIdentifier("name2", true, Nullable.NotNull, "default expression", "default constraint name", "description"),
            };
            var op = new AddTableOperation("schema", "table", columns, false, "file group", "text image file group", "file stream file group", new string[0]);
            var addRowGuidColOp = new RemoveRowGuidColOperation("SCHEMA", "TABLE", "name");

            op.Merge(addRowGuidColOp);
            Assert.That(op.Disabled, Is.False);
            Assert.That(addRowGuidColOp.Disabled, Is.True);
            Assert.That(op.Columns[0].RowGuidCol, Is.False);
            Assert.That(op.Columns[1].RowGuidCol, Is.True);
        }
        public void ShouldRemoveRowGuidColToUpdatedColumn()
        {
            var columns = new Column[]
            {
                Column.UniqueIdentifier("uuid", true, Nullable.Null, null, null, "description"),
                Column.UniqueIdentifier("uuid2", true, Nullable.Null, null, null, "description"),
                Column.Int("uuid", Nullable.Null, null, null, "description"),
            };

            columns[2].RowGuidCol = true;
            var op = new UpdateTableOperation("schema", "table", new Column[0], columns, new string[0]);
            var removeRowGuidColOp = new RemoveRowGuidColOperation("SCHEMA", "TABLE", "UUID");

            op.Merge(removeRowGuidColOp);
            Assert.That(op.Disabled, Is.False);
            Assert.That(removeRowGuidColOp.Disabled, Is.True);
            Assert.That(op.UpdateColumns[0].RowGuidCol, Is.False);
            Assert.That(op.UpdateColumns[1].RowGuidCol, Is.True);
            Assert.That(op.UpdateColumns[2].RowGuidCol, Is.True);
        }