public void TestCustomLogger() { this.Test(async runtime => { using (CustomLogger logger = new CustomLogger()) { runtime.Logger = logger; var tcs = new TaskCompletionSource <bool>(); runtime.RegisterMonitor <TestMonitor>(); runtime.Monitor <TestMonitor>(new SetupEvent(tcs)); runtime.CreateActor(typeof(M)); await this.WaitAsync(tcs.Task); await Task.Delay(200); Assert.True(tcs.Task.IsCompleted, "The task await returned but the task is not completed???"); string expected = @"<CreateLog> TestMonitor was created. <MonitorLog> TestMonitor enters state 'Init'. <MonitorLog> TestMonitor is processing event 'SetupEvent' in state 'Init'. <MonitorLog> TestMonitor executed action 'OnSetup' in state 'Init'. <CreateLog> M() was created by task ''. <CreateLog> N() was created by M(). <SendLog> M() in state '' sent event 'E' to N(). <EnqueueLog> N() enqueued event 'E'. <StateLog> N() enters state 'Init'. <ActionLog> N() invoked action 'OnInitEntry' in state 'Init'. <DequeueLog> N() dequeued event 'E' in state 'Init'. <GotoLog> N() is transitioning from state 'Init' to state 'N.Act'. <StateLog> N() exits state 'Init'. <StateLog> N() enters state 'Act'. <ActionLog> N() invoked action 'ActOnEntry' in state 'Act'. <SendLog> N() in state 'Act' sent event 'E' to M(). <EnqueueLog> M() enqueued event 'E'. <DequeueLog> M() dequeued event 'E'. <ActionLog> M() invoked action 'Act'. <MonitorLog> TestMonitor is processing event 'CompletedEvent' in state 'Init'. <MonitorLog> TestMonitor executed action 'OnCompleted' in state 'Init'."; string actual = logger.ToString().RemoveNonDeterministicValues(); expected = expected.NormalizeNewLines(); actual = actual.SortLines(); // threading makes this non-deterministic otherwise. expected = expected.SortLines(); Assert.Equal(expected, actual); } }, this.GetConfiguration()); }