public void ShouldDisableWhenMergedWithRemoveOperation() { var op = new AddPrimaryKeyOperation("schema", "table", "name", new string[0], false, new string[0]); var removeOp = new RemovePrimaryKeyOperation("SCHEMA", "TABLE", "NAME"); op.Merge(removeOp); Assert.That(op.Disabled, Is.True); Assert.That(removeOp.Disabled, Is.True); }
public void ShouldSetPropertiesForRemovePrimaryKey() { const string schemaName = "schemaName"; const string tableName = "tableName"; const string name = "primary key"; var removePrimaryKeyOperation = new RemovePrimaryKeyOperation(schemaName, tableName, name); var op = removePrimaryKeyOperation; Assert.AreEqual(schemaName, op.SchemaName); Assert.AreEqual(tableName, op.TableName); Assert.That(op.ObjectName, Is.EqualTo($"{schemaName}.{name}")); Assert.That(op.TableObjectName, Is.EqualTo($"{schemaName}.{tableName}")); Assert.That(op.Name, Is.EqualTo(name)); var expectedQuery = string.Format("alter table [{0}].[{1}] drop constraint [{2}]", schemaName, tableName, name); Assert.AreEqual(expectedQuery, op.ToQuery()); }