コード例 #1
0
        public void ApplyShouldWorkOnSelectedPropertyOfImmutableState()
        {
            ImmutableTree state = new ImmutableTree(1, false);

            ReducerComposer <ImmutableTree> composer = new ReducerComposer <ImmutableTree>();

            composer.AddSubTreeReducer(new ImmutableIntPropReducer())
            .AddSubTreeReducer(new ImmutableBoolPropReducer());
            state = composer.Apply(state, "");
            Assert.AreEqual(2, state.IntProp);
            Assert.AreEqual(true, state.BoolProp);
        }
コード例 #2
0
        public void ApplyShouldWorkOnSelectedPropertyOfState()
        {
            Tree state = new Tree();

            state.IntProp  = 1;
            state.BoolProp = false;
            ReducerComposer <Tree> composer = new ReducerComposer <Tree>();

            composer.AddSubTreeReducer(new IntPropReducer())
            .AddSubTreeReducer(new BoolPropReducer());
            composer.Apply(state, "");
            Assert.AreEqual(2, state.IntProp);
            Assert.AreEqual(true, state.BoolProp);
        }