You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If trying to complete with the same state, this is a noop (idempotent)
106
-
if(step.CompletionState==completionState)
107
-
{
108
-
return;
109
-
}
110
-
111
-
// If trying to transition from a terminal state to a different terminal state, this is a coding bug
112
-
thrownewInvalidOperationException($"Cannot complete step '{step.Id}' with state '{completionState}'. Step is already in terminal state '{step.CompletionState}'.");
// If trying to complete with the same state, this is a noop (idempotent)
210
-
if(task.CompletionState==completionState)
211
-
{
212
-
return;
213
-
}
214
-
215
-
// If trying to transition from a terminal state to a different terminal state, this is a coding bug
216
-
thrownewInvalidOperationException($"Cannot complete task '{task.Id}' with state '{completionState}'. Task is already in terminal state '{task.CompletionState}'.");
Assert.Contains($"Cannot complete task '{taskInternal.Id}' with state 'CompletedWithError'. Task is already in terminal state 'Completed'.",exception.Message);
425
+
Assert.Equal(CompletionState.Completed,taskInternal.CompletionState);// Original state is retained
421
426
}
422
427
423
428
[Fact]
@@ -446,7 +451,7 @@ public async Task CompleteStepAsync_IdempotentWhenCompletedWithSameState()
Assert.Contains($"Cannot complete step '{stepInternal.Id}' with state 'CompletedWithError'. Step is already in terminal state 'Completed'.",exception.Message);
474
+
Assert.Equal(CompletionState.Completed,stepInternal.CompletionState);// Original state is retained
475
+
Assert.Equal("Complete",stepInternal.CompletionText);// Original completion text is retained
465
476
}
466
477
467
478
[Fact]
@@ -486,13 +497,9 @@ public async Task CompleteStepAsync_KeepsStepInDictionaryForAggregation()
Assert.Contains($"Cannot complete task '{taskInternal.Id}' with state 'CompletedWithError'. Task is already in terminal state 'Completed'.",completeException.Message);
502
+
awaittask.CompleteAsync("Error",CompletionState.CompletedWithError,cancellationToken:CancellationToken.None);// Should also not throw (noop)
496
503
497
504
// Creating new tasks for the completed step should also fail because the step is complete
Assert.Contains($"Cannot complete task '{taskInternal.Id}' with state '{secondState}'. Task is already in terminal state '{firstState}'.",exception.Message);
1102
+
Assert.Equal(firstState,taskInternal.CompletionState);// Original state is retained
1091
1103
}
1092
1104
1093
1105
[Theory]
@@ -1097,7 +1109,7 @@ public async Task CompleteTaskAsync_ThrowsWhenTransitioningBetweenTerminalStates
Assert.Contains($"Cannot complete step '{stepInternal.Id}' with state '{secondState}'. Step is already in terminal state '{firstState}'.",exception.Message);
1132
+
Assert.Equal(firstState,stepInternal.CompletionState);// Original state is retained
0 commit comments