public void WhenDescendantActionIsDispatched_ThenTriggersSubscription() { var dispatchedAction = new TestDescendantAction(); TestAction receivedAction = null; Subject.SubscribeToAction <TestAction>(this, x => receivedAction = x); Subject.Dispatch(dispatchedAction); Assert.Same(dispatchedAction, receivedAction); }
public void WhenAncestorActionIsDispatched_ThenDoesNotTriggerSubscriptionsForDescendantActionTypes() { var dispatchedAncestorAction = new TestAction(); TestAction receivedAncestorAction = null; TestDescendantAction receivedDescendantAction = null; Subject.SubscribeToAction <TestAction>(this, x => receivedAncestorAction = x); Subject.SubscribeToAction <TestDescendantAction>(this, x => receivedDescendantAction = x); Subject.Dispatch(dispatchedAncestorAction); Assert.Same(dispatchedAncestorAction, receivedAncestorAction); Assert.Null(receivedDescendantAction); }