public void WaitForOperatorEmitsElementsThrowsExceptionDespiteRestart()
        {
            var facade = new TestFacade();

            var synced = new Synced <Exception>();

            facade.Schedule(() =>
            {
                var workflow = new WaitForWorkflow(1000);
                Sync.AfterNext(workflow.EmitEventsToSource, true);
                Sync.AfterNext(workflow.SetFieldVariableAfterWaitedFor, true);
            });

            Thread.Sleep(100);

            facade.PersistAndCloseDown();

            Thread.Sleep(100);

            facade.LoadAgain();

            Thread.Sleep(3000);

            synced.Value.ShouldBeNull();

            var thrownException = facade.Resolve <WaitForWorkflow>().ThrownException;

            (thrownException is TimeoutException).ShouldBeTrue();

            facade.Dispose();
        }
        public void WaitForOperatorEmitsElementsBeforeTimeOutDespiteRestart()
        {
            var facade = new TestFacade();

            var synced = new Synced <WaitForWorkflow>();

            facade.Schedule(() =>
            {
                var workflow = new WaitForWorkflow(5000);

                Sync.AfterNext(workflow.EmitEventsToSource, true);
                Sync.AfterNext(workflow.SetFieldVariableAfterWaitedFor, true);
            });

            Thread.Sleep(100);

            facade.PersistAndCloseDown();

            Thread.Sleep(100);

            facade.LoadAgain();

            Thread.Sleep(3000);

            synced.Value.ShouldBeNull();

            var w = facade.Resolve <WaitForWorkflow>();

            w.Emits.ToArray().Length.ShouldBe(5);

            facade.Dispose();
        }