public void RemoveKeyField_EmptyKeyFields_DoesNothing() { var testField = new Field("TestField"); var subGroup = new SubGroup("/"); subGroup.RemoveKeyField(testField); Assert.Empty(subGroup.KeyFields); }
public void RemoveKeyField_SubGroupOwnsKeyField_RemovesKeyField() { var testField = new Field("TestField"); var subGroup = new SubGroup("/"); subGroup.AddKeyField(testField); Assert.Contains(testField, subGroup.KeyFields); subGroup.RemoveKeyField(testField); Assert.Empty(subGroup.KeyFields); }
public void RemoveKeyField_ParentGroupOwnsKeyField_DoesNothing() { var parentKeyField = new Field("ParentKeyField"); var childKeyField = new Field("SubKeyField"); var parentGroup = new SubGroup("Parent"); var childGroup = new SubGroup("Child"); parentGroup.AddKeyField(parentKeyField); parentGroup.AddGroup(childGroup); childGroup.AddKeyField(childKeyField); Assert.Contains(parentKeyField, childGroup.KeyFields); Assert.Contains(childKeyField, childGroup.KeyFields); childGroup.RemoveKeyField(parentKeyField); Assert.Contains(parentKeyField, childGroup.KeyFields); Assert.Contains(childKeyField, childGroup.KeyFields); }