Beispiel #1
0
        public void KeyFields_Get_ReturnsParentAndChildKeys()
        {
            var parentKeyField = new Field("ParentKey");
            var childKeyField  = new Field("ChildKeyField");
            var rootGroup      = new SubGroup("/");

            rootGroup.AddKeyField(parentKeyField);
            var childGroup = new SubGroup("Child");

            childGroup.AddKeyField(childKeyField);
            rootGroup.AddGroup(childGroup);

            Assert.Contains(parentKeyField, childGroup.KeyFields);
            Assert.Contains(childKeyField, childGroup.KeyFields);
        }
Beispiel #2
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);
        }