Skip to content

Commit

Permalink
Added FlowIdCanBeExtractedFromWorkflowInstance-test
Browse files Browse the repository at this point in the history
  • Loading branch information
stidsborg committed Nov 3, 2024
1 parent 1ffa031 commit bcf53b6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ public override Task EffectsAreNotFetchedOnFirstInvocation()
[TestMethod]
public override Task EffectsAreFetchedOnSecondInvocation()
=> EffectsAreFetchedOnSecondInvocation(FunctionStoreFactory.Create());

[TestMethod]
public override Task FlowIdCanBeExtractedFromWorkflowInstance()
=> FlowIdCanBeExtractedFromWorkflowInstance(FunctionStoreFactory.Create());
}
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,31 @@ await BusyWait.Until(

controlPanel.Status.ShouldBe(Status.Failed);
}

public abstract Task FlowIdCanBeExtractedFromWorkflowInstance();
public async Task FlowIdCanBeExtractedFromWorkflowInstance(Task<IFunctionStore> storeTask)
{
var store = await storeTask;
var flowType = nameof(SunshineScenarioFunc).ToFlowType();
var flowInstance = Guid.NewGuid().ToString();

var unhandledExceptionHandler = new UnhandledExceptionCatcher();

using var functionsRegistry = new FunctionsRegistry(store, new Settings(unhandledExceptionHandler.Catch));

FlowId? flowId = null;
var reg = functionsRegistry
.RegisterParamless(
flowType,
workflow =>
{
flowId = workflow.FlowId;
return Task.CompletedTask;
}
);
await reg.Invoke(flowInstance);

flowId.ShouldBe(new FlowId(flowType, flowInstance));
unhandledExceptionHandler.ShouldNotHaveExceptions();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ public override Task EffectsAreNotFetchedOnFirstInvocation()
[TestMethod]
public override Task EffectsAreFetchedOnSecondInvocation()
=> EffectsAreFetchedOnSecondInvocation(FunctionStoreFactory.Create());

[TestMethod]
public override Task FlowIdCanBeExtractedFromWorkflowInstance()
=> FlowIdCanBeExtractedFromWorkflowInstance(FunctionStoreFactory.Create());
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ public override Task EffectsAreNotFetchedOnFirstInvocation()
[TestMethod]
public override Task EffectsAreFetchedOnSecondInvocation()
=> EffectsAreFetchedOnSecondInvocation(FunctionStoreFactory.Create());

[TestMethod]
public override Task FlowIdCanBeExtractedFromWorkflowInstance()
=> FlowIdCanBeExtractedFromWorkflowInstance(FunctionStoreFactory.Create());
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ public override Task EffectsAreNotFetchedOnFirstInvocation()
[TestMethod]
public override Task EffectsAreFetchedOnSecondInvocation()
=> EffectsAreFetchedOnSecondInvocation(FunctionStoreFactory.Create());

[TestMethod]
public override Task FlowIdCanBeExtractedFromWorkflowInstance()
=> FlowIdCanBeExtractedFromWorkflowInstance(FunctionStoreFactory.Create());
}

0 comments on commit bcf53b6

Please sign in to comment.