コード例 #1
0
            public void ActivatesMiddleware_WhenPageHasAlreadyLoaded()
            {
                var subject = new Store(StoreInitializer);

                subject.Initialize();
                StoreInitializer.Complete();

                var mockMiddleware = new Mock <IMiddleware>();

                subject.AddMiddleware(mockMiddleware.Object);

                mockMiddleware
                .Verify(x => x.Initialize(subject));
            }
コード例 #2
0
            public void ActivatesMiddleware_WhenStoreInitializerCompletes()
            {
                var subject = new Store(StoreInitializer);

                subject.Initialize();
                var mockMiddleware = new Mock <IMiddleware>();

                subject.AddMiddleware(mockMiddleware.Object);

                StoreInitializer.Complete();

                mockMiddleware
                .Verify(x => x.InitializeAsync(subject));
            }
コード例 #3
0
        public Dispatch()
        {
            StartEvent = new ManualResetEvent(false);
            var storeInitializer = new TestStoreInitializer();

            Store = new Store(storeInitializer);
            Store.Initialize();

            Feature = new CounterFeature();
            Store.AddFeature(Feature);

            Feature.AddReducer(new IncrementCounterReducer());
            storeInitializer.Complete();
        }
コード例 #4
0
            public void DoesNotDispatchActions_WhenIsInsideMiddlewareChange()
            {
                var mockMiddleware = MockMiddlewareFactory.Create();

                var subject = new Store(StoreInitializer);

                subject.Initialize();
                subject.AddMiddleware(mockMiddleware.Object);

                StoreInitializer.Complete();

                var testAction = new TestAction();

                using (subject.BeginInternalMiddlewareChange())
                {
                    subject.Dispatch(testAction);
                }

                mockMiddleware.Verify(x => x.MayDispatchAction(testAction), Times.Never);
            }