コード例 #1
0
        public void Instrumentation()
        {
            /*
             *      A
             *     / \
             *    B   Throws
             *    |   |
             *    C   Skipped
             *   / \ /
             *  E   D
             */
            var instrumentation = new TestInstrumentation();

            engine.AddInstrumentation(instrumentation);

            var a       = new SinglePropertyType();
            var b       = new SinglePropertyType();
            var c       = new SinglePropertyType();
            var d       = new SinglePropertyType();
            var e       = new SinglePropertyType();
            var throws  = new SinglePropertyType();
            var skipped = new SinglePropertyType();

            engine.Assign(() => b.Value).From(() => a.Value, ex => { });
            engine.Assign(() => c.Value).From(() => b.Value, ex => { });
            engine.Assign(() => throws.Value).From(() => ThrowsInvalidOperationException(a.Value), ex => { });
            engine.Assign(() => skipped.Value).From(() => throws.Value, ex => { });
            engine.Assign(() => d.Value).From(() => c.Value + skipped.Value, ex => { });
            engine.Assign(() => e.Value).From(() => c.Value, ex => { });

            a.Value = 2;
            engine.ValueHasChanged(a, "Value");

            var dotFormat = engine.ToDotFormat("Title");

            Console.WriteLine(dotFormat);

            instrumentation.WalkIndexStart.ShouldBe(1);
            instrumentation.WalkIndexEnd.ShouldBe(1);
            instrumentation.NodeEvaluations.Count.ShouldBe(8);
        }
コード例 #2
0
 public NotifyPropertyChangedTests()
 {
     engineInstrumentation = new TestInstrumentation();
     engine = new DependencyEngine();
     engine.AddInstrumentation(engineInstrumentation);
 }