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); }
/// <summary> /// Adds an update to an <see cref="AssignablePipelineStage{TValue}"/>. /// </summary> /// <typeparam name="TValue">The data type.</typeparam> /// <param name="transaction">The transaction.</param> /// <param name="stage">The stage to set value for.</param> /// <param name="value">The new value.</param> /// <returns>The same transaction object.</returns> public static IPipelineTransaction Update <TValue>(this IPipelineTransaction transaction, AssignablePipelineStage <TValue> stage, TValue value) { bool AssignableUpdate() => stage.SetValueWithoutInvalidating(value); return(transaction.Update(stage, AssignableUpdate)); }