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
     }
 }
        public void TestValidBuildCartesian()
        {
            var nodeFactory = AssemblyStrategyTreeBuilder.Build(1, Convert(new int[][] { new int[] { }, new int[] { 0, 2 }, new int[] { } }), new bool[] { 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);
        }
        public void TestValidBuildSimpleOptReq()
        {
            var nodeFactory = AssemblyStrategyTreeBuilder.Build(2, Convert(new int[][] { new int[] { }, new int[] { 0 }, new int[] { 1 } }), new bool[] { true, false, true });

            var child1 = (RootOptionalAssemblyNodeFactory)nodeFactory;

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

            var child1_1 = (BranchRequiredAssemblyNodeFactory)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);
        }