Esempio n. 1
0
        /// <summary>
        /// Dispatches an async action creator.
        /// </summary>
        /// <param name="asyncActionCreator">
        /// A function that creates and dispatches actions asynchronously.
        /// </param>
        /// <returns>A task that represents the asynchronous dispatch actions.</returns>
        public async Task Dispatch(AsyncActionCreatorDelegate <TState> asyncActionCreator)
        {
            if (asyncActionCreator == null)
            {
                throw new ArgumentNullException(nameof(asyncActionCreator));
            }

            await asyncActionCreator(State, this, Dispatch).ConfigureAwait(false);
        }
Esempio n. 2
0
 public async Task DispatchNullAsyncActionCreatorTest()
 {
     var store = new Store <AppState>(new AppReducer());
     AsyncActionCreatorDelegate <AppState> asyncActionCreator = null;
     await Assert.ThrowsAsync <ArgumentNullException>(async() =>
     {
         await store.Dispatch(asyncActionCreator);
     });
 }