jeudi 22 janvier 2015

How do I assert activity counts in a workflow trace after a unit test?

I am unit testing a WF4 service using the Unit testing Nuget package. There is a functionality for asserting that stuff does or does not exist in the end-of-test tracking information.


Consider the following unit test code:



WorkflowServiceTestHost host = null;
using (host = CreateHost())
{
var proxy = new ServiceClient(Binding, ServiceAddress);
// Call receive points in the workflow

}
finally
{
host.Tracking.Trace();
// I would like to assert stuff like the WF did not abort
// For now, I would just like to assert that there are a
// certain number of invocations of a specific activity.
// I can find no examples of how to call this:
host.Tracking.Assert.ExistsCount(?????what goes here???);
}


How does one call ExistsCount()? The prototype looks like this:



public void ExistsCount<TRecord>(Predicate<TRecord> predicate, int count, string message = null) where TRecord : TrackingRecord


but I can find no examples or documentation to understand what is expected for the predicate.


Aucun commentaire:

Enregistrer un commentaire