TestAsync Activity

An AsyncCodeActivity that will sleep for a specified duration

Namespace: Microsoft.ActivitiesUnitTesting.Activities
Assembly: Microsoft.ActivitiesUnitTesting.dll

Properties

Type Name Description
int Sleep The number of milliseconds for the activity to sleep before completing

Example

[TestMethod]
public void EpisodeShouldEndWithCumulativeTimeout()
{
    // Arrange
    var host =
        WorkflowApplicationTest.Create(
            new Sequence
                {
                    Activities =
                        {
                            new TestAsync { Sleep = 20 }, 
                            new TestAsync { Sleep = 20 }, 
                            new TestAsync { Sleep = 20 }, 
                        }
                });

    // Act
    try
    {
        // Run the activity until it aborts
        Assert.AreEqual(
            EpisodeEndedWith.Timeout, 
            host.RunEpisodeAsync(EpisodeIdleOption.RunUntilIdleWithBookmarks, 10).Result.EpisodeResult);
    }
    finally
    {
        host.Tracking.Trace();
    }
}

Last edited Dec 23, 2010 at 6:16 PM by ronjacobs, version 1

Comments

No comments yet.