public void Dispatch_Should_call_Reducer_Reduce_and_Effect_Invoke_method_When_called() { var reducer = new TestStateReducer(); var effect = new SetItemsEffect(); var store = Store.Create() .WithState(TestState.Initial, reducer) .WithEffects(new Effect[] { effect }); store.Dispatch(new SetItemsAction(new List <string>())); Assert.Single(reducer.ReduceCalls.Where(c => c == typeof(SetItemsAction).FullName)); Assert.Equal(1, effect.CallCount); }
public void Dispatch_Should_call_Reducer_Reduce_and_observable_should_invoke() { var reducer = new TestStateReducer(); var store = Store.Create() .WithState(TestState.Initial, reducer); var newObject = new ReferenceObect(); ReferenceObect selectedObect = null; var disposable = store.Select <TestState, ReferenceObect>(f => f.ReferenceObect) .Subscribe(f => selectedObect = f); store.Dispatch(new SetReferenceObjectAction(newObject)); disposable.Dispose(); Assert.Same(newObject, selectedObect); }