public async Task Can_cancel_external_event() { var client = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services); var input = TimeSpanInput.FromMinutes(1); var ct = new CancellationTokenSource(); ct.Token.Register(() => { Console.WriteLine("cancelled"); }); TimeSpanInput.Token = ct.Token; var instanceId = await client .StartNewAsync(nameof(Funcs.DurableFunctionWithExternalEventTimeoutCancel), input); await Task.Delay(10); ct.Cancel(false); 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 Can_timeshift_external_event_timeout() { var client = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services); var instanceId = await client .StartNewAsync(nameof(Funcs.DurableFunctionWithExternalEventTimeout), TimeSpanInput.FromMinutes(1)); await client.Timeshift(instanceId, TimeSpan.FromMinutes(2)); await client.WaitForOrchestrationToReachStatus(instanceId, OrchestrationRuntimeStatus.Failed); var status = await client.GetStatusAsync(instanceId); TestUtil.LogHistory(status, Console.Out, true); Assert.AreEqual(OrchestrationRuntimeStatus.Failed, status.RuntimeStatus); }