示例#1
0
        public void RecursiveCommendationTest()
        {
            var sElement = new ResourceProjectionElement
            {
                Name        = "Attribute",
                FillingInfo = new FillingInfo {
                    { "Name", FillingInfo.FillType.Native }
                },
                ResourceType = "Attribute",
                Namespace    = "Test"
            };
            var sGroup = new ResourceProjectionElement
            {
                Name        = "Element",
                FillingInfo = new FillingInfo {
                    { "Name", FillingInfo.FillType.Native }
                },
                ResourceType = "Element",
                Namespace    = "Test",
            };

            var gToGRelation = new Relation {
                ChildElement = sGroup, ParentElement = sGroup
            };
            var eFromEQuery = Query.CreateTestStubQuery(null, null, "element");

            gToGRelation.Queries = new[] { eFromEQuery };
            sGroup.UpRelations.Add(gToGRelation);
            sGroup.DownRelations.Add(gToGRelation);

            var eToGRelation = new Relation {
                ChildElement = sElement, ParentElement = sGroup
            };
            var aFromEQuery = Query.CreateTestStubQuery(null, null, "element");

            eToGRelation.Queries = new[] { aFromEQuery };
            sElement.UpRelations.Add(eToGRelation);
            sGroup.DownRelations.Add(eToGRelation);

            var cc = new CommendationCollection();

            var acc = GetAccumulator(gToGRelation, eFromEQuery);

            cc.AddNewStep(new PlanStep(sGroup, sGroup, new ParameterNames(), acc, new ParameterNames(), 0));
            acc = GetAccumulator(eToGRelation, aFromEQuery);
            cc.AddNewStep(new PlanStep(sGroup, sElement, new ParameterNames(), acc, new ParameterNames(), 0));

            var root = new FrameNodeGroup(sGroup,
                                          new[] { new FrameNode(Guid.Empty, sGroup, 0, new Dictionary <string, object>()) },
                                          new ParameterNames());
            var nodes = cc.GetNewGroups(new[] { root });

            Assert.AreEqual(2, nodes.Count());
            nodes = cc.GetNewGroups(nodes);
            Assert.AreEqual(2, nodes.Count());
            nodes = cc.GetNewGroups(nodes);
            Assert.AreEqual(2, nodes.Count());
        }
示例#2
0
 public TestFramingPlan(ProjectionElement root, CommendationCollection collection)
     : base(root)
 {
     _commendations = collection;
 }