public async Task RetryTask_works_with_no_exceptions() { var task = new RetryTask(() => FailingTask(0, new TimeoutException())); await task.RunAsync(); _callbackCounter.ShouldBe(1); }
public void RetryCustomHandlerFailThroughProxyTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.Handle = e => { Assert.IsInstanceOfType(e, typeof(TaskFailedException), "Exception is not TaskFailedException."); var taskFailed = (TaskFailedException)e; return(taskFailed.InnerException is ArgumentNullException); }; var retryTask = new RetryTask(2); taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .Start(); RetryOrchestration.Result = null; OrchestrationInstance id = client.CreateOrchestrationInstance(RETRY_NAME, RETRY_VERSION, true); bool isCompleted = TestHelpers.WaitForInstance(client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 90)); Assert.AreEqual("DoWork Failed. RetryCount is: 1", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(1, retryTask.RetryCount, "Retry Count is wrong"); }
public void BasicSubOrchestrationRetryTest() { var parentRetryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 2) { BackoffCoefficient = 2.0, MaxRetryInterval = TimeSpan.FromSeconds(4), }; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); var retryTask = new RetryTask(4); RetryOrchestration.rethrowException = true; taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_PARENT_NAME, RETRY_PARENT_VERSION, () => new ParentOrchestration(parentRetryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .Start(); ParentOrchestration.Result = null; RetryOrchestration.Result = null; OrchestrationInstance id = client.CreateOrchestrationInstance(RETRY_PARENT_NAME, RETRY_PARENT_VERSION, false); bool isCompleted = TestHelpers.WaitForInstance(client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 90)); Assert.AreEqual("DoWork Succeeded. Attempts: 4", ParentOrchestration.Result, "Orchestration Result is wrong!!!"); }
public async Task TestHostRetryCustomHandlerFailThroughProxyTest() { var testHost = new OrchestrationTestHost(); testHost.ClockSpeedUpFactor = 10; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.Handle = e => { Assert.IsInstanceOfType(e, typeof(TaskFailedException), "Exception is not TaskFailedException."); var taskFailed = (TaskFailedException)e; return(taskFailed.InnerException is ArgumentNullException); }; var retryTask = new RetryTask(2); testHost.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask); RetryOrchestration.Result = null; string result = await testHost.RunOrchestration <string>(RETRY_NAME, RETRY_VERSION, true); Assert.AreEqual("DoWork Failed. RetryCount is: 1", result, "Orchestration Result is wrong!!!"); Assert.AreEqual("DoWork Failed. RetryCount is: 1", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(1, retryTask.RetryCount, "Retry Count is wrong"); }
public async Task RetryTimeoutTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(5), 10); retryOptions.BackoffCoefficient = 2; retryOptions.RetryTimeout = TimeSpan.FromSeconds(10); var retryTask = new RetryTask(3); await this.taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryName, RetryVersion, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); RetryOrchestration.Result = null; OrchestrationInstance id = await this.client.CreateOrchestrationInstanceAsync(RetryName, RetryVersion, false); bool isCompleted = await TestHelpers.WaitForInstanceAsync(this.client, id, 60); Assert.IsNotNull(RetryOrchestration.Result); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(this.client, id, 60)); Assert.IsTrue(RetryOrchestration.Result.StartsWith("DoWork Failed. RetryCount is:"), "Orchestration Result is wrong!!!. Result: " + RetryOrchestration.Result); Assert.IsTrue(retryTask.RetryCount < 4, "Retry Count is wrong. Count: " + retryTask.RetryCount); }
public async Task RetryTask_works_with_exception() { var task = new RetryTask(() => FailingTask(1, new TimeoutException()), 3, noWaitProvider); await task.RunAsync(); _callbackCounter.ShouldBe(2); }
public async Task RetryCustomHandlerFailTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.Handle = e => { Assert.IsInstanceOfType(e, typeof(TaskFailedException), "Exception is not TaskFailedException."); var taskFailed = (TaskFailedException)e; return(taskFailed.InnerException is ArgumentNullException); }; var retryTask = new RetryTask(2); await this.taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryName, RetryVersion, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); RetryOrchestration.Result = null; OrchestrationInstance id = await this.client.CreateOrchestrationInstanceAsync(RetryName, RetryVersion, false); bool isCompleted = await TestHelpers.WaitForInstanceAsync(this.client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(this.client, id, 90)); Assert.AreEqual("DoWork Failed. RetryCount is: 1", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(1, retryTask.RetryCount, "Retry Count is wrong"); }
public async Task RetryOnReasonCustomHandlerTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.Handle = e => { Assert.IsInstanceOfType(e, typeof(TaskFailedException), "Exception is not TaskFailedException."); var taskFailed = (TaskFailedException)e; Assert.IsInstanceOfType(taskFailed.InnerException, typeof(InvalidOperationException), "InnerException is not InvalidOperationException."); return(e.Message.StartsWith("DoWork Failed. RetryCount is:")); }; var retryTask = new RetryTask(2); await this.taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryName, RetryVersion, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); this.taskHub.TaskActivityDispatcher.IncludeDetails = true; RetryOrchestration.Result = null; OrchestrationInstance id = await this.client.CreateOrchestrationInstanceAsync(RetryName, RetryVersion, false); bool isCompleted = await TestHelpers.WaitForInstanceAsync(this.client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(this.client, id, 90)); Assert.AreEqual("DoWork Succeeded. Attempts: 2", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(2, retryTask.RetryCount, "Retry Count is wrong"); }
public async Task RetryTask_fails_after_four_exceptions() { var task = new RetryTask(() => FailingTask(4, new TimeoutException()), 3, noWaitProvider); await task.RunAsync().ShouldThrowAsync <TimeoutException>(); _callbackCounter.ShouldBe(4); }
public async Task RetryTask_does_not_retry_non_transient_exceptions() { var task = new RetryTask(() => FailingTask(4, new ArgumentNullException()), 3, noWaitProvider); await task.RunAsync().ShouldThrowAsync <ArgumentNullException>(); _callbackCounter.ShouldBe(1); }
public void RetryCustomHandlerPassTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.Handle = e => { Assert.IsInstanceOfType(e, typeof(TaskFailedException), "Exception is not TaskFailedException."); var taskFailed = (TaskFailedException)e; return(taskFailed.InnerException is InvalidOperationException); }; var retryTask = new RetryTask(2); taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .Start(); taskHub.TaskActivityDispatcher.IncludeDetails = true; RetryOrchestration.Result = null; OrchestrationInstance id = client.CreateOrchestrationInstance(RETRY_NAME, RETRY_VERSION, false); bool isCompleted = TestHelpers.WaitForInstance(client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 90)); Assert.AreEqual("DoWork Succeeded. Attempts: 2", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(2, retryTask.RetryCount, "Retry Count is wrong"); }
public async Task BasicSubOrchestrationRetryTest() { var parentRetryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 2) { BackoffCoefficient = 2.0, MaxRetryInterval = TimeSpan.FromSeconds(4), }; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); var retryTask = new RetryTask(4); RetryOrchestration.RethrowException = true; await this.taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryName, RetryVersion, () => new RetryOrchestration(retryOptions))) .AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryParentName, RetryParentVersion, () => new ParentOrchestration(parentRetryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); ParentOrchestration.Result = null; RetryOrchestration.Result = null; OrchestrationInstance id = await this.client.CreateOrchestrationInstanceAsync(RetryParentName, RetryParentVersion, false); bool isCompleted = await TestHelpers.WaitForInstanceAsync(this.client, id, 90); Assert.IsNotNull(RetryOrchestration.Result); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(this.client, id, 90)); Assert.AreEqual("DoWork Succeeded. Attempts: 4", ParentOrchestration.Result, "Orchestration Result is wrong!!!"); }
public async Task TestHostRetryTimeoutTest() { var testHost = new OrchestrationTestHost(); testHost.ClockSpeedUpFactor = 10; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(5), 10); retryOptions.BackoffCoefficient = 2; retryOptions.RetryTimeout = TimeSpan.FromSeconds(10); var retryTask = new RetryTask(3); testHost.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask); RetryOrchestration.Result = null; string result = await testHost.RunOrchestration <string>(RETRY_NAME, RETRY_VERSION, false); Assert.IsTrue(result.StartsWith("DoWork Failed. RetryCount is:"), "Orchestration Result is wrong!!!. Result: " + result); Assert.IsTrue(RetryOrchestration.Result.StartsWith("DoWork Failed. RetryCount is:"), "Orchestration Result is wrong!!!. Result: " + RetryOrchestration.Result); Assert.IsTrue(retryTask.RetryCount < 4, "Retry Count is wrong. Count: " + retryTask.RetryCount); }
public async Task RetryMaxIntervalTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.BackoffCoefficient = 10; retryOptions.MaxRetryInterval = TimeSpan.FromSeconds(5); var retryTask = new RetryTask(2); await this.taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryName, RetryVersion, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); RetryOrchestration.Result = null; OrchestrationInstance id = await this.client.CreateOrchestrationInstanceAsync(RetryName, RetryVersion, false); bool isCompleted = await TestHelpers.WaitForInstanceAsync(this.client, id, 90); Assert.IsNotNull(RetryOrchestration.Result); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(this.client, id, 90)); Assert.AreEqual("DoWork Succeeded. Attempts: 2", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(2, retryTask.RetryCount, "Retry Count is wrong"); }
public async Task TestHostRetryOnReasonCustomHandlerTest() { var testHost = new OrchestrationTestHost(); testHost.ClockSpeedUpFactor = 10; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.Handle = e => { Assert.IsInstanceOfType(e, typeof(TaskFailedException), "Exception is not TaskFailedException."); var taskFailed = (TaskFailedException)e; Assert.IsInstanceOfType(taskFailed.InnerException, typeof(InvalidOperationException), "InnerException is not InvalidOperationException."); return(e.Message.StartsWith("DoWork Failed. RetryCount is:")); }; var retryTask = new RetryTask(2); testHost.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask); RetryOrchestration.Result = null; string result = await testHost.RunOrchestration <string>(RETRY_NAME, RETRY_VERSION, false); Assert.AreEqual("DoWork Succeeded. Attempts: 2", result, "Orchestration Result is wrong!!!"); Assert.AreEqual("DoWork Succeeded. Attempts: 2", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(2, retryTask.RetryCount, "Retry Count is wrong"); }
private void CreateRetry(CalendarItem item, RetryAction action) { if (Retry == null) { var retry = new RetryTask(item, m_currentCalendar, action); Scheduler.Scheduler.Instance.AddRetry(retry); } else { Retry.RetryFailed(); Retry = null; } }
public async Task RetryFailProxyTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); var retryTask = new RetryTask(3); await taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); RetryOrchestration.Result = null; OrchestrationInstance id = await client.CreateOrchestrationInstanceAsync(RETRY_NAME, RETRY_VERSION, null); bool isCompleted = await TestHelpers.WaitForInstanceAsync(client, id, 120); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 120)); Assert.AreEqual("RetryCount is: 3", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); }
public async Task SubOrchestrationRetryExhaustedTest() { ArgumentException argumentException = null; try { // ReSharper disable once ObjectCreationAsStatement new RetryOptions(TimeSpan.Zero, 10); } catch (ArgumentException ex) { argumentException = ex; } Assert.IsNotNull(argumentException); Assert.AreEqual( "Invalid interval. Specify a TimeSpan value greater then TimeSpan.Zero.\r\nParameter name: firstRetryInterval", argumentException.Message); var parentRetryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 2) { BackoffCoefficient = 2.0, MaxRetryInterval = TimeSpan.FromSeconds(4), }; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 2); var retryTask = new RetryTask(4); RetryOrchestration.RethrowException = true; await this.taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryName, RetryVersion, () => new RetryOrchestration(retryOptions))) .AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryParentName, RetryParentVersion, () => new ParentOrchestration(parentRetryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); ParentOrchestration.Result = null; RetryOrchestration.Result = null; OrchestrationInstance id = await this.client.CreateOrchestrationInstanceAsync(RetryParentName, RetryParentVersion, false); bool isCompleted = await TestHelpers.WaitForInstanceAsync(this.client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(this.client, id, 90)); Assert.AreEqual("DoWork Failed. RetryCount is: 4", ParentOrchestration.Result, "Orchestration Result is wrong!!!"); }
public void SubOrchestrationRetryExhaustedTest() { ArgumentException argumentException = null; try { new RetryOptions(TimeSpan.Zero, 10); } catch (ArgumentException ex) { argumentException = ex; } Assert.IsNotNull(argumentException); Assert.AreEqual( "Invalid interval. Specify a TimeSpan value greater then TimeSpan.Zero.\r\nParameter name: firstRetryInterval", argumentException.Message); var parentRetryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 2) { BackoffCoefficient = 2.0, MaxRetryInterval = TimeSpan.FromSeconds(4), }; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 2); var retryTask = new RetryTask(4); RetryOrchestration.rethrowException = true; taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_PARENT_NAME, RETRY_PARENT_VERSION, () => new ParentOrchestration(parentRetryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .Start(); ParentOrchestration.Result = null; RetryOrchestration.Result = null; OrchestrationInstance id = client.CreateOrchestrationInstance(RETRY_PARENT_NAME, RETRY_PARENT_VERSION, false); bool isCompleted = TestHelpers.WaitForInstance(client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 90)); Assert.AreEqual("DoWork Failed. RetryCount is: 4", ParentOrchestration.Result, "Orchestration Result is wrong!!!"); }
public async Task TestHostBasicRetryFailTest() { var testHost = new OrchestrationTestHost(); testHost.ClockSpeedUpFactor = 10; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); var retryTask = new RetryTask(3); testHost.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask); RetryOrchestration.Result = null; string result = await testHost.RunOrchestration <string>(RETRY_NAME, RETRY_VERSION, false); Assert.AreEqual("DoWork Failed. RetryCount is: 3", result, "Orchestration Result is wrong!!!"); Assert.AreEqual("DoWork Failed. RetryCount is: 3", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); }
public void BasicRetryFailNoCompressionTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); var retryTask = new RetryTask(3); taskHubNoCompression.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .Start(); RetryOrchestration.Result = null; OrchestrationInstance id = client.CreateOrchestrationInstance(RETRY_NAME, RETRY_VERSION, false); bool isCompleted = TestHelpers.WaitForInstance(client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 90)); Assert.AreEqual("DoWork Failed. RetryCount is: 3", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); }
public async Task BasicRetryFailTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); var retryTask = new RetryTask(3); await this.taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RetryName, RetryVersion, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .StartAsync(); RetryOrchestration.Result = null; OrchestrationInstance id = await this.client.CreateOrchestrationInstanceAsync(RetryName, RetryVersion, false); bool isCompleted = await TestHelpers.WaitForInstanceAsync(this.client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(this.client, id, 90)); Assert.AreEqual("DoWork Failed. RetryCount is: 3", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); }
public async Task TestHostRetryMaxIntervalTest() { var testHost = new OrchestrationTestHost(); testHost.ClockSpeedUpFactor = 10; var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.BackoffCoefficient = 10; retryOptions.MaxRetryInterval = TimeSpan.FromSeconds(5); var retryTask = new RetryTask(2); testHost.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask); RetryOrchestration.Result = null; string result = await testHost.RunOrchestration <string>(RETRY_NAME, RETRY_VERSION, false); Assert.AreEqual("DoWork Succeeded. Attempts: 2", result, "Orchestration Result is wrong!!!"); Assert.AreEqual("DoWork Succeeded. Attempts: 2", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(2, retryTask.RetryCount, "Retry Count is wrong"); }
public void RetryTimeoutThroughProxyTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(5), 10); retryOptions.BackoffCoefficient = 2; retryOptions.RetryTimeout = TimeSpan.FromSeconds(10); var retryTask = new RetryTask(3); taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .Start(); RetryOrchestration.Result = null; OrchestrationInstance id = client.CreateOrchestrationInstance(RETRY_NAME, RETRY_VERSION, true); bool isCompleted = TestHelpers.WaitForInstance(client, id, 60); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 60)); Assert.IsTrue(RetryOrchestration.Result.StartsWith("DoWork Failed. RetryCount is:"), "Orchestration Result is wrong!!!. Result: " + RetryOrchestration.Result); Assert.IsTrue(retryTask.RetryCount < 4, "Retry Count is wrong. Count: " + retryTask.RetryCount); }
public void RetryMaxIntervalThroughProxyTest() { var retryOptions = new RetryOptions(TimeSpan.FromSeconds(3), 3); retryOptions.BackoffCoefficient = 10; retryOptions.MaxRetryInterval = TimeSpan.FromSeconds(5); var retryTask = new RetryTask(2); taskHub.AddTaskOrchestrations(new TestObjectCreator <TaskOrchestration>(RETRY_NAME, RETRY_VERSION, () => new RetryOrchestration(retryOptions))) .AddTaskActivitiesFromInterface <IRetryTask>(retryTask) .Start(); RetryOrchestration.Result = null; OrchestrationInstance id = client.CreateOrchestrationInstance(RETRY_NAME, RETRY_VERSION, true); bool isCompleted = TestHelpers.WaitForInstance(client, id, 90); Assert.IsTrue(isCompleted, TestHelpers.GetInstanceNotCompletedMessage(client, id, 90)); Assert.AreEqual("DoWork Succeeded. Attempts: 2", RetryOrchestration.Result, "Orchestration Result is wrong!!!"); Assert.AreEqual(2, retryTask.RetryCount, "Retry Count is wrong"); }