示例#1
0
        public void RemoveKeyField_EmptyKeyFields_DoesNothing()
        {
            var testField = new Field("TestField");
            var subGroup  = new SubGroup("/");

            subGroup.RemoveKeyField(testField);
            Assert.Empty(subGroup.KeyFields);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }