コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReduxStore{T}" class/>
        /// </summary>
        /// <param name="reducer">Reducer to use for state transformations.</param>
        /// <param name="initialStateFactory">Factory used to create the initial state of the application.</param>
        public ReduxStore(
            IReduxReducer <T> reducer,
            IReduxStateFactory <T> initialStateFactory)
        {
            if (initialStateFactory is null)
            {
                throw new ArgumentNullException(nameof(initialStateFactory));
            }

            _subscriptions = new SubscriptionMiddleware(this);

            _reducer = new ReducingMiddleware(
                reducer ?? throw new ArgumentNullException(nameof(reducer)),
                initialStateFactory.Create());

            _processingQueue
                = new Cached <ImmutableQueue <IReduxMiddleware> >(
                      CreateProcessingQueue);
        }
コード例 #2
0
 public PlaygroundReduxDispatcher(RootState initialState, IReduxReducer <RootState> reducer) :
     base(initialState, reducer, TaskScheduler.FromCurrentSynchronizationContext())
 {
 }
コード例 #3
0
 public TestDispatcher(RootState initialState, IReduxReducer <RootState> reducer, TaskScheduler notificationScheduler) : base(initialState, reducer, notificationScheduler)
 {
 }
コード例 #4
0
 public void SetUp()
 {
     initialState = new RootState();
     reducer      = Substitute.For <IReduxReducer <RootState> >();
     dispatcher   = new TestDispatcher(initialState, reducer, TaskScheduler.Current);
 }