public void WhenActivityWithBookmarkIsResumedWithWrongNameExceptionIsThrown()
        {
            const string WaitForBookmarkName = "TestBookmark";

            var workflowApplication =
                new WorkflowApplication(
                    new Sequence
                        {
                            Activities =
                                {
                                    new Delay { Duration = TimeSpan.FromMilliseconds(1) },
                                    new Delay { Duration = TimeSpan.FromMilliseconds(1) },
                                    new Delay { Duration = TimeSpan.FromMilliseconds(1) },
                                    new TestBookmark<int>
                                        {
                                           DisplayName = WaitForBookmarkName, BookmarkName = WaitForBookmarkName
                                        }
                                }
                        });

            // Run through three idle events and end the episode when idle with a bookmark named "TestBookmark"
            Assert.AreEqual(ActivityInstanceState.Executing, workflowApplication.RunEpisode(WaitForBookmarkName).State);

            var exception =
                AssertHelper.Throws<BookmarkResumptionException>(
                    workflowApplication.ResumeEpisodeBookmarkAsync("WrongName", null));
            Assert.AreEqual("WrongName", exception.BookmarkName);
            Assert.AreEqual(BookmarkResumptionResult.NotFound, exception.Result);
        }
        public void WhenActivityWithBookmarkGoesIdleResumeBookmarkAsyncShouldReturnWorkflowCompletedEpisodeResult()
        {
            var workflowApplication = new WorkflowApplication(new TestBookmark<int> { BookmarkName = "Test" });

            // Run to the idle
            Assert.AreEqual(
                ActivityInstanceState.Executing, workflowApplication.RunEpisode("Test", Constants.Timeout).State);

            // Resume and complete
            var result = workflowApplication.ResumeEpisodeBookmarkAsync("Test", 1).Result;

            Assert.IsInstanceOfType(result, typeof(WorkflowCompletedEpisodeResult));
            Assert.AreEqual(ActivityInstanceState.Closed, result.State);
            AssertOutArgument.AreEqual(((WorkflowCompletedEpisodeResult)result).Outputs, "Result", 1);
        }