public void IsReadOnlyDetectsReadOnly() { const string BookmarkName = "Test"; var activity = new TestBookmark<int> { BookmarkName = BookmarkName }; var workflowApplication = new WorkflowApplication(activity); // Before you run it, the application is not readonly var readOnly = workflowApplication.IsReadOnly(); Assert.IsFalse(readOnly); // Once you run the WorkflowApplication it becomes read only workflowApplication.RunEpisode(BookmarkName, Constants.Timeout); // This will cause an exception // System.InvalidOperationException was unhandled by user code // Message=WorkflowInstanceExtensionsManager cannot be modified once it has been associated with a WorkflowInstance. AssertHelper.Throws<InvalidOperationException>( () => workflowApplication.Extensions.Add(new TraceTrackingParticipant())); readOnly = workflowApplication.IsReadOnly(); Assert.IsTrue(readOnly); }