Exemple #1
0
        void Test02()
        {
            // Arrange
            var rootpayload = "rootpayload";
            var subject = new ContextBuilder<string>(() => rootpayload);
            var child1payload = "child1payload";
            subject.Enter("child1", () => child1payload);
            var child2payload = "child2payload";
            subject.Enter("child2", () => child2payload);
            subject.Leave();
            var child3payload = "child3payload";
            subject.Enter("child3", () => child3payload);
            subject.Leave();
            subject.Leave();

            Action<string, dynamic> build = (payload, obj) => { obj.property = payload; };

            // Act
            var result = subject.Flatten(build);

            // Assert
            //assert.equivalent([{name:'/',property:rootpayload},{name:'/child1',property:child1payload},{name:'/child1/child2',property:child2payload},{name:'/child1/child3',property:child3payload}], obj);
        }