Exemple #1
0
            public void ShouldExecuteReducerFunction_WhenReducerFunctionIsRegisteredForActionType()
            {
                var testSubject = new MultiActionReducerTestSubject();

                var state     = new MultiActionReducerTestState(41);
                var addAction = new AddAction(1);

                state = testSubject.Reduce(state, addAction);
                Assert.Equal(42, state.Balance);

                state = new MultiActionReducerTestState(4);
                var multiplyAction = new MultiplyAction(10);

                state = testSubject.Reduce(state, multiplyAction);
                Assert.Equal(40, state.Balance);
            }
Exemple #2
0
            public void ShouldThrowInvalidOperationException_WhenNoReducerFunctionIsRegisteredForActionType()
            {
                var testSubject = new MultiActionReducerTestSubject();

                var state             = new MultiActionReducerTestState(42);
                var unsupportedAction = new UnsupportedAction();

                Assert.Throws <InvalidOperationException>(() =>
                                                          state = testSubject.Reduce(state, unsupportedAction));
            }