public void ValueInvalidateWhileInSuspendedStateIsRememberedAsPending() { var value = Assignable(10); var sut = new SuspendingPipelineStage <int>(value, Suspender(PipelineSuspensionState.Suspend)); value.SetValue(11); Assert.IsTrue(sut.HasPendingInvalidate); }
public void DependenciesToInputAndSuspensionAreRegisteredCorrectly() { var value = Assignable(10); var suspend = Suspender(PipelineSuspensionState.Resume); var sut = new SuspendingPipelineStage <int>(value, suspend); PipelineAssert.DependentOn(sut, value, suspend); }
public void ResumeWithoutInvalidationFromInputDoesNotInvalidateStage(PipelineSuspensionState resumeState) { var state = Suspender(PipelineSuspensionState.Suspend); var sut = new SuspendingPipelineStage <int>(1.AsPipelineConstant(), state); var test = sut.AttachTestStage(); state.SetValue(resumeState); test.AssertInvalidations(0); }
public void InvalidateIsOnlyPropagatedInResumedSuspensionStates(PipelineSuspensionState state, int expectedInvalidations) { var value = Assignable(10); var sut = new SuspendingPipelineStage <int>(value, Suspender(state)); var test = sut.AttachTestStage(); value.SetValue(11); test.AssertInvalidations(expectedInvalidations); }
public void PendingInvalidateIsEnactedWhenChangingState(PipelineSuspensionState resumeState, int expectedInvalidations) { var value = Assignable(10); var state = Suspender(PipelineSuspensionState.Suspend); var sut = new SuspendingPipelineStage <int>(value, state); var test = sut.AttachTestStage(); value.SetValue(2); test.AssertInvalidations(0); Assert.IsTrue(sut.HasPendingInvalidate); state.SetValue(resumeState); test.AssertInvalidations(expectedInvalidations); }
public void NewValueAndChangedStageAtTheSameTimeHasTheIntendedReaction(PipelineSuspensionState initial, PipelineSuspensionState state, int invalidations) { var stateStage = Suspender(initial); var value = new AssignablePipelineStage <int>("", 1); var sut = new SuspendingPipelineStage <int>(value, stateStage); var test = sut.AttachTestStage(); value.SetValueWithoutInvalidating(2); stateStage.SetValueWithoutInvalidating(state); PipelineCore.Invalidate(stateStage, value); test.AssertInvalidations(invalidations); PipelineAssert.Value(sut, 2); }
public void PipelineStartsInExpectedState() { var sut = new SuspendingPipelineStage <double>(0.2.AsPipelineConstant(), Suspender(PipelineSuspensionState.Resume)); Assert.AreEqual(PipelineSuspensionState.Resume, sut.SuspensionState); }