public void Returns_A_Composite_Reducer_That_Maps_The_State_Keys_To_Given_Reducers() { var reducer = Redux.CombineReducers <State, Reducer>(); var state1 = reducer(new State(), new IncrementAction()); Assert.Equal(1, state1.Counter); Assert.Equal(new String[0], state1.Stack); var state2 = reducer(state1, new StackAction { Value = "a" }); Assert.Equal(1, state2.Counter); Assert.Equal(new String[] { "a" }, state2.Stack); }
public void ReturnsACompositeReducerThatMapsTheStateKeysToGivenReducers() { var reducer = Redux.CombineReducers <State, Reducer>(); var state1 = reducer(new State(), new IncrementAction()); Assert.Equal(1, state1.Counter); Assert.Equal(new String[0], state1.Stack); var state2 = reducer(state1, new StackAction { Value = "a" }); Assert.Equal(1, state2.Counter); Assert.Equal(new String[] { "a" }, state2.Stack); }
public void ThrowsErrorIfPublicStatePropertyTypesDoNotPatchPublicStaticReducerMethodReturnTypes() { Assert.Throws <KeyTypeMismatchException>(() => Redux.CombineReducers <NonMatchingStatePropertyTypes, Reducer>()); }
public void Throws_An_Error_If_Public_State_Properties_Do_Not_Match_Public_Static_Reducer_Methods() { Assert.Throws <KeyMismatchException>(() => Redux.CombineReducers <NonMatchingStateProperties, Reducer>()); }