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();
        }
Beispiel #2
0
        public void Send(byte[] msg)
        {
            var array    = new ImmutableByteArray(msg);
            var msgIndex = _unackedQueue.Enqueue(array);

            Sync.AfterNext(() => _connection.Send(msgIndex, array), false);
        }
        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();
        }