public async Task Can_execute_durable_function_with_return() { var input = new TestFunctionInput(); var client = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services); var instanceId = await client .StartNewAsync(nameof(Funcs.DurableFunctionWithOneActivityReturn), input); await client.WaitForOrchestrationToReachStatus(instanceId, OrchestrationRuntimeStatus.Completed); var status = await client.GetStatusAsync(instanceId); TestUtil.LogHistory(status, Console.Out); Assert.AreEqual(OrchestrationRuntimeStatus.Completed, status.RuntimeStatus); }
public async Task Adds_TaskFailed_history_event_for_unknown_orchestration_function() { var input = new TestFunctionInput(); var client = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services); var noSuchFuncName = "NoSuchFunction"; var instanceId = await client .StartNewAsync(noSuchFuncName, input); var status = await client.GetStatusAsync(instanceId); AssertHistoryEventOrder(status, EventType.ExecutionStarted, EventType.TaskFailed, EventType.ExecutionCompleted); }
public async Task Activity_can_redefine_input_without_leaking_into_orchestrator_context() { var startInput = new TestFunctionInput { Token = "original" }; var client = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services); var instanceId = await client .StartNewAsync(nameof(Funcs.DurableFunctionWithSeparateActivityInput), startInput); await client.WaitForOrchestrationToReachStatus(instanceId, OrchestrationRuntimeStatus.Completed); var status = await client.GetStatusAsync(instanceId); var endInput = status.Input.ToObject <TestFunctionInput>(); TestUtil.LogHistory(status, Console.Out); Assert.AreEqual(startInput.Token, endInput.Token, "Activity redefining input should not leak into orchestrator"); }
public async Task Functions_cannot_mutate_their_input_source() { var startInput = new TestFunctionInput { Token = "original" }; var client = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services); var instanceId = await client .StartNewAsync(nameof(Funcs.DurableFunctionWithMutatedInput), startInput); await client.WaitForOrchestrationToReachStatus(instanceId, OrchestrationRuntimeStatus.Completed); var status = await client.GetStatusAsync(instanceId); var endInput = status.Input.ToObject <TestFunctionInput>(); TestUtil.LogHistory(status, Console.Out); Assert.AreEqual(OrchestrationRuntimeStatus.Completed, status.RuntimeStatus); Assert.AreEqual(startInput.Token, endInput.Token, "Functions mutating inputs should not mutate their source"); }