Search

Search:

Namespace:

Search Result
.
        Console.WriteLine(state.theData)
.
    Console.WriteLine(helloWorld.HelloWorld("Maurice"))
.

Console.WriteLine(helloWorld.HelloWorld("Maurice"))

.
        Console.WriteLine(helloWorld.HelloWorld("Maurice"))
.
        Console.WriteLine(helloWorld.HelloWorld("Maurice"))
.
  Console.WriteLine("Hello, World");
.
                Console.WriteLine(ve.ErrorText)
.
        Console.WriteLine(state.theData)
.
  Console.WriteLine("Hello, World");
.
        Console.WriteLine("Done.");
.

Console.WriteLine("Possible state transitions");

.
    Console.WriteLine("\t{0}", item);
.
        Console.WriteLine(proxy.AskQuestion("Is this cool?"))
.
        Console.WriteLine(proxy.AskQuestion("To be or not to be?"))
.
        Console.WriteLine(proxy.AskQuestion("Is this cool?"))
.
        Console.WriteLine(proxy.AskQuestion("To be or not to be?"))
.
        Console.WriteLine(proxy.AskQuestion("Is this cool?"))
.
        Console.WriteLine(type.FullName)
.
                Console.WriteLine(vbTab + element.GetType().FullName)
.
            Console.WriteLine(ex.Message)
.
    Console.WriteLine()
.

Console.WriteLine(proxy.GetData(2));

.
    Console.WriteLine(error);
.
                Console.WriteLine("Press enter to stop...")
.
                Console.WriteLine("Press enter to stop...");
.
    Console.WriteLine("State history:");
.
        Console.WriteLine("\t{0}", item);
.

The PolicyActivity is rather cool but with more than a few rules in the RuleSet and full chaining enabled it can become a bit hard to see what is going on. Now it would be nice if we could step through the rules with the debugger but if there is a way I haven't found it yet. Of course you could add Console.WriteLine statements to the actions, after all they can be multiple statements. There is however an easier way that will show exactly what the runtime engine is doing and that is tracing.

.

public partial class WriteLineActivity3 : Activity

.
    public WriteLineActivity3()
.
            WriteLineService3 service = executionContext.GetService<WriteLineService3>();
.
            service.WriteLine(Message, queueName);
.
    WriteLineActivity3_Accessor target = new WriteLineActivity3_Accessor();
.
    WriteLineService3 service = RecorderManager.CreateMockedObject<WriteLineService3>();
.
        executionContext.GetService<WriteLineService3>();
.

In this test I actually check that the runtime service, called WriteLineService3 in this case, is never retrieved. This test is still pretty simple and no more complicated than the test we did previously.

.
    WriteLineActivity3_Accessor target = new WriteLineActivity3_Accessor();
.
    WriteLineService3 service = RecorderManager.CreateMockedObject<WriteLineService3>();
.
        executionContext.GetService<WriteLineService3>();
.
        service.WriteLine(null, null);
.
    WriteLineActivity3_Accessor target = new WriteLineActivity3_Accessor();
.

public class WriteLineService3: WorkflowRuntimeService

.
    public void WriteLine(string message, IComparable queueName)
.
        ThreadPool.QueueUserWorkItem(state => WriteLineAsync(message, instanceId, queueName));
.
    private void WriteLineAsync(string message, Guid instanceId, IComparable queueName)
.
        Console.WriteLine(message);
.

///A test for WriteLine

.

public void WriteLineTest()

.
    WriteLineService3_Accessor target = new WriteLineService3_Accessor(); 
.
    target.WriteLine(message, queueName);
.

public partial class WriteLineActivity1 : Activity

.
    public WriteLineActivity1()
.
            Console.WriteLine(Message);
.
    WriteLineActivity1_Accessor target = 
.
        new WriteLineActivity1_Accessor();
.

But admittedly this is an oversimplification. In a more realistic activity the actual Console.WriteLine(), or whatever the activity needs done, would be implemented in a workflow runtime service so its implementation can be changed independently of the workflow. And that means using the ActivityExecutionContext to retrieve a reference to the service.

.

public partial class WriteLineActivity2: Activity

.
    public WriteLineActivity2()
.
            WriteLineService2 service = 
.
                executionContext.GetService<WriteLineService2>();
.
            service.WriteLine(Message);
.

public class WriteLineService2

.
    public void WriteLine(string message)
.
        Console.WriteLine(message);
.
    WriteLineActivity2_Accessor target = new WriteLineActivity2_Accessor();
.
    WriteLineActivity2_Accessor target = new WriteLineActivity2_Accessor();
.
    WriteLineService2 service = 
.
        RecorderManager.CreateMockedObject<WriteLineService2>();
.
        service.WriteLine(null);
.
        executionContext.GetService<WriteLineService2>();
.

In this case we are mocking the ActivityExecutionContext using the RecorderManager.CreateMockedObject<ActivityExecutionContext>() statement. And this mock ActivityExecutionContext returns a mock WriteLineService2 when asked, pretty cool right? Big Smile

.
        Console.WriteLine("The data is '{0}'", data)
.
        Console.WriteLine("Testing with data '{0}'", data)
.
        Console.WriteLine("Starting child with '{0}'", _
.
                Console.WriteLine(ve.ErrorText)
.
        Console.WriteLine(workflows.GetStatus())