Esempio n. 1
0
        public void Callsite_ElementBinding_Functions_UniqueIds_ForReplicationOfInnerAndOuterFunction()
        {
            WrapperObject.ResetNextID();
            var ws = Open <HomeWorkspaceModel>(TestDirectory, callsiteDir, "func_nested_replication.dyn");

            BeginRun();
            AssertPreviewValue("22e0f3229b314aa48914e8f6b925872c", Enumerable.Range(1, 3).ToList());
            // this node currently rebinds to its inner callsites so there are repeated values being returned.
            // it's not clear this behavior is correct, but it matches expected results with zeroTouch nodes nested in
            // other zero touch nodes which access trace. This test is created to note the current behavior and to
            // alert us if it changes.
            AssertPreviewValue("74cd0ca6d4964ec2b500fbe96139d28c", new int[][] {
                new int[] { 4 },
                new int[] { 4, 5 },
                new int[] { 4, 5, 6 },
                new int[] { 4, 5, 6, 7 }
            });

            /*
             * AssertPreviewValue("74cd0ca6d4964ec2b500fbe96139d28c", new int[][] {
             * new int[] {4},
             * new int[] {5,6 },
             * new int[]{7,8,9 },
             * new int[]{10,11,12,13 }
             * });
             */
        }
Esempio n. 2
0
        public void Callsite_ElementBinding_ShouldReturnUniqueIds()
        {
            WrapperObject.ResetNextID();
            var ws = Open <HomeWorkspaceModel>(TestDirectory, callsiteDir, "nonNestedWorking_replication.dyn");

            BeginRun();
            AssertPreviewValue("a74679f905fc4883bb017851d94ac074", Enumerable.Range(1, 6).ToList());
        }
Esempio n. 3
0
        public void Callsite_ElementBinding_CustomNodes_ShouldReturnUniqueIds()
        {
            WrapperObject.ResetNextID();
            var ws = Open <HomeWorkspaceModel>(TestDirectory, callsiteDir, "element_binding_customNodes_replication.dyn");

            BeginRun();
            AssertPreviewValue("3cab31e7c7e646cfb11f6145edf1d8c3", Enumerable.Range(1, 6).ToList());
        }
Esempio n. 4
0
        public void Callsite_ElementBinding_CustomNodes2dReplication_ShouldReturnUniqueIds()
        {
            WrapperObject.ResetNextID();
            var ws = Open <HomeWorkspaceModel>(TestDirectory, callsiteDir, "element_binding_customNodes_replication2d.dyn");

            BeginRun();
            AssertPreviewValue("3cab31e7c7e646cfb11f6145edf1d8c3", new int[][] {
                new int[] { 1 },
                new int[] { 2, 3 },
                new int[] { 4, 5, 6 },
                new int[] { 7, 8, 9, 10 },
                new int[] { 11, 12, 13, 14, 15 },
                new int[] { 16, 17, 18, 19, 20, 21 }
            });
        }
Esempio n. 5
0
        public void Callsite_ElementBinding_CustomNodes_MultipleRunsShouldResetInvocationCount()
        {
            WrapperObject.ResetNextID();
            var ws = Open <HomeWorkspaceModel>(TestDirectory, callsiteDir, "element_binding_customNodes_replication.dyn");

            BeginRun();
            AssertPreviewValue("3cab31e7c7e646cfb11f6145edf1d8c3", Enumerable.Range(1, 6).ToList());

            //grab the inner callsite inside the custom node
            var callsite = this.CurrentDynamoModel.EngineController.LiveRunnerRuntimeCore.RuntimeData.CallsiteCache.
                           Where(kv => kv.Key.Contains("WrapperObject")).FirstOrDefault().Value;

            //should have executed 6 times
            Assert.AreEqual(callsite.invokeCount, 6);

            //force a re execution and if binding succeeds then data should be unchanged.
            ws.Nodes.OfType <CodeBlockNodeModel>().First().SetCodeContent("5..10", ws.ElementResolver);
            AssertPreviewValue("3cab31e7c7e646cfb11f6145edf1d8c3", Enumerable.Range(1, 6).ToList());
            //count should have been reset and invoked 6 more times
            Assert.AreEqual(callsite.invokeCount, 6);
        }
Esempio n. 6
0
        public void Single_CallSite_Should_Rebind()
        {
            WrapperObject.ResetNextID();
            var ws = Open <HomeWorkspaceModel>(TestDirectory, callsiteDir, "single_callsite.dyn");

            //assert there is only one callsite
            Assert.AreEqual(1, this.CurrentDynamoModel.EngineController.LiveRunnerRuntimeCore.RuntimeData.CallsiteCache.Keys.Count);
            var callsite = this.CurrentDynamoModel.EngineController.LiveRunnerRuntimeCore.RuntimeData.CallsiteCache.FirstOrDefault().Value;

            Assert.AreEqual(1, callsite.invokeCount);
            var traceid     = Guid.Parse("08278f9e8ae64c72b86313e04cdde709");
            var traceNode   = CurrentDynamoModel.CurrentWorkspace.Nodes.Where(x => x.GUID == traceid).FirstOrDefault();
            var firstresult = (traceNode.CachedValue.Data as WrapperObject).ID;

            //run the graph again.
            ws.Nodes.OfType <CodeBlockNodeModel>().First().SetCodeContent("2", ws.ElementResolver);
            Assert.AreEqual(1, this.CurrentDynamoModel.EngineController.LiveRunnerRuntimeCore.RuntimeData.CallsiteCache.Keys.Count);
            Assert.AreEqual(1, callsite.invokeCount);
            var secondResult = (traceNode.CachedValue.Data as WrapperObject).ID;

            Assert.AreEqual(firstresult, secondResult);
        }