public void CircularUpdates_DoNotLoopForever() { int loopCount = 0; ReduxValueSubscription <string, int> subscription = null !; using (subscription = new ReduxValueSubscription <string, int>( s => s.Length, ValueChanged, WhenReleased)) { subscription.Publish("bang"); } void ValueChanged(int _) { loopCount++.Should().BeLessThan(10); subscription.Publish("bang"); } }
public void FirstPublication_InvokesWhenChangedWithValue() { const string state = "sample"; _subscription.Publish(state); _whenCalledCount.Should().Be(1); _lastWhenCalledValue.Should().Be(6); }
public void AfterDisposal_PublishDoesNotInvokeWhenChanged() { _subscription.Dispose(); _subscription.Publish("sample"); _whenCalledCount.Should().Be(0); }