Exemple #1
0
        public async Task Can_WaitForOrchestrationToFinish_when_failed()
        {
            var input = new TestFunctionInputAsync();

            var client     = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services);
            var instanceId = await client
                             .StartNewAsync(nameof(Funcs.FailAtGivenCallNoActivity), input);

            var status = await client.WaitForOrchestrationToFinish(instanceId);

            Assert.AreEqual(OrchestrationRuntimeStatus.Failed, status.RuntimeStatus);
        }
Exemple #2
0
        public async Task Can_WaitForOrchestrationToFinish_when_success()
        {
            var input = new TestFunctionInputAsync();

            var client     = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services);
            var instanceId = await client
                             .StartNewAsync(nameof(Funcs.DurableFunctionWithOneActivityAsync), input);

            var status = await client.WaitForOrchestrationToFinish(instanceId);

            Assert.AreEqual(OrchestrationRuntimeStatus.Completed, status.RuntimeStatus);
        }
        public async Task Can_WaitForCustomStatus_to_match_predicate()
        {
            var input = new TestFunctionInputAsync();

            var client     = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services);
            var instanceId = await client
                             .StartNewAsync(nameof(Funcs.DurableFunctionWithCustomStatus), input);

            var status = await client.WaitForCustomStatus(instanceId, c => c?.ToObject <CustomStatus>() != null);

            Assert.AreEqual(OrchestrationRuntimeStatus.Running, status.RuntimeStatus);

            Assert.IsNotNull(status.CustomStatus);
        }
Exemple #4
0
        public async Task Can_execute_durable_function_async()
        {
            var input = new TestFunctionInputAsync();

            var client     = new InMemoryOrchestrationClient(typeof(Funcs).Assembly, _services);
            var instanceId = await client
                             .StartNewAsync(nameof(Funcs.DurableFunctionWithOneActivityAsync), input);

            await client.WaitForOrchestrationToReachStatus(instanceId, OrchestrationRuntimeStatus.Completed);

            var status = await client.GetStatusAsync(instanceId);

            TestUtil.LogHistory(status, Console.Out);
            Assert.AreEqual(OrchestrationRuntimeStatus.Completed, status.RuntimeStatus);
        }