public void ShouldDisableWhenMergedWithRemoveOperation() { var op = new AddForeignKeyOperation("schema", "table", "name", new string[0], "ref_schema", "ref_table", new string[0], "delete", "update", false, false); var removeOp = new RemoveForeignKeyOperation("SCHEMA", "TABLE", "NAME"); op.Merge(removeOp); Assert.That(op.Disabled, Is.True); Assert.That(removeOp.Disabled, Is.True); }
public void ShouldWriteQueryForRemoveForeignKey() { const string schemaName = "schemaName"; const string tableName = "tableName"; const string name = "constraintName"; var op = new RemoveForeignKeyOperation(schemaName, tableName, name); var expectedQuery = $"alter table [{schemaName}].[{tableName}] drop constraint [{name}]"; Assert.AreEqual(expectedQuery, op.ToQuery()); }
public void ShouldNotDisableAddIfRemovingAForeignKeyOnTheSameTable() { var op = new AddForeignKeyOperation("schema", "table", "name", new string[0], "ref schema", "ref table", new string[0], "on delete", "on update", false, false); var removeOp = new RemoveForeignKeyOperation("schema", "table", "name2"); op.Merge(removeOp); Assert.That(removeOp.Disabled, Is.False); Assert.That(op.Disabled, Is.False); }
public void ShouldSetPropertiesForRemoveForeignKey() { const string schemaName = "schemaName"; const string tableName = "tableName"; const string name = "name"; var op = new RemoveForeignKeyOperation(schemaName, tableName, name); 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)); }