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)); }
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)); }
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(); }
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); }