Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
private OneOf<WorkCompletedResult, ProgressMadeResult, SetbackResult>
GetWorkOnItemResult(CrewContext context, WorkItem item)
var roll = context.GetRandomNumber(1, 20);
// Something went wrong. Likely a mistaken assumption or bad requirement
if (roll == 1)
return new SetbackResult(Priority.High);
// We got a massive success or we've previously made significant progress
if (roll >= 20 - item.ProgressMade)
return new WorkCompletedResult(item);
// Okay, not a great roll, let's call it a setback
if (roll < 3)
return new SetbackResult(Priority.Normal);
// Just a bit of progress
return new ProgressMadeResult(item);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment