public void Addition() { IKey key = GetKey(); IMergeOperation <IKey> op = new KeyAdditionOperation(key.Parent, key); Assert.That(op.ToString(), Is.EqualTo("DB1.Table2.KeyV Added")); }
public void The_Original_Database_Should_Contain_A_Copy_Of_The_New_Key() { var db1 = TestDatabaseLoader.TestDatabase(); // Setup new key information Table parentTable = new Table("Table1"); parentTable.AddColumn(new Column("Column3")); Key newKey = new Key("UQ_Column3"); newKey.Parent = parentTable; newKey.AddColumn("Column3"); KeyAdditionOperation op = new KeyAdditionOperation(db1.Tables[0], newKey); op.RunOperation(); op.RunSecondStep(); Assert.That(db1.Tables[0].Keys, Has.Count(2)); Assert.That(db1.Tables[0].Keys[1].Name, Is.EqualTo(newKey.Name)); Assert.That(db1.Tables[0].Keys[1], Is.Not.SameAs(newKey), "The added Key should be a copy, not the original object."); Assert.That(db1.Tables[0].Keys[1].Columns[0], Is.SameAs(db1.Tables[0].Columns[2]), "The new key should reference existing columns, not the new ones"); Assert.That(db1.Tables[0].Keys[1].Parent, Is.SameAs(db1.Tables[0]), "The new key's parent should be Table1 in the existing database"); }
public void Addition() { IKey key = GetKey(); IMergeOperation<IKey> op = new KeyAdditionOperation(key.Parent, key); Assert.That(op.ToString(), Is.EqualTo("DB1.Table2.KeyV Added")); }