Esempio n. 1
0
        public void TestValidBuildSimpleReqOpt()
        {
            var nodeFactory = AssemblyStrategyTreeBuilder.Build(
                2,
                Convert(
                    new[] {
                new int[] { }, new[] { 0 }, new[] { 1 }
            }),
                new[] { false, true, true });

            var child1 = (RootRequiredAssemblyNodeFactory)nodeFactory;

            Assert.AreEqual(2, child1.StreamNum);
            Assert.AreEqual(1, child1.ChildNodes.Count);
            Assert.AreEqual(null, child1.ParentNode);

            var child1_1 = (BranchOptionalAssemblyNodeFactory)child1.ChildNodes[0];

            Assert.AreEqual(1, child1_1.StreamNum);
            Assert.AreEqual(1, child1_1.ChildNodes.Count);
            Assert.AreEqual(child1, child1_1.ParentNode);

            var leaf1_2 = (LeafAssemblyNodeFactory)child1_1.ChildNodes[0];

            Assert.AreEqual(0, leaf1_2.StreamNum);
            Assert.AreEqual(0, leaf1_2.ChildNodes.Count);
            Assert.AreEqual(child1_1, leaf1_2.ParentNode);
        }
Esempio n. 2
0
 private void TryInvalidBuild(
     int rootStream,
     IDictionary <int, int[]> joinedPerStream,
     bool[] isInnerPerStream)
 {
     try
     {
         AssemblyStrategyTreeBuilder.Build(rootStream, joinedPerStream, isInnerPerStream);
         Assert.Fail();
     }
     catch (ArgumentException ex)
     {
         log.Debug(".tryInvalidBuild expected exception=" + ex);
         // expected
     }
 }
Esempio n. 3
0
        public void TestValidBuildCartesian()
        {
            var nodeFactory = AssemblyStrategyTreeBuilder.Build(
                1,
                Convert(new[] { new int[] { }, new[] { 0, 2 }, new int[] { } }),
                new[] { false, true, false });

            var top = (RootCartProdAssemblyNodeFactory)nodeFactory;

            Assert.AreEqual(2, top.ChildNodes.Count);

            var leaf1 = (LeafAssemblyNodeFactory)top.ChildNodes[0];

            Assert.AreEqual(0, leaf1.StreamNum);
            Assert.AreEqual(0, leaf1.ChildNodes.Count);
            Assert.AreEqual(top, leaf1.ParentNode);

            var leaf2 = (LeafAssemblyNodeFactory)top.ChildNodes[0];

            Assert.AreEqual(0, leaf2.StreamNum);
            Assert.AreEqual(0, leaf2.ChildNodes.Count);
            Assert.AreEqual(top, leaf2.ParentNode);
        }