Esempio n. 1
0
        public void SetUp()
        {
            theContext  = new TestEnvelopeContext();
            theEnvelope = ObjectMother.Envelope();

            new NoSubscriberHandler().Execute(theEnvelope, theContext);
        }
        public void SetUp()
        {
            theContext = new TestEnvelopeContext();
            theEnvelope = ObjectMother.Envelope();

            new NoSubscriberHandler().Execute(theEnvelope, theContext);
        }
        public void SetUp()
        {
            _envelope = ObjectMother.Envelope();
            _message = new object();
            _context = new TestEnvelopeContext();

            new RespondWithMessageContinuation(_message).Execute(_envelope, _context);
        }
        public void SetUp()
        {
            _envelope = ObjectMother.Envelope();
            _message  = new object();
            _context  = new TestEnvelopeContext();

            new RespondWithMessageContinuation(_message).Execute(_envelope, _context);
        }
Esempio n. 5
0
        protected override void beforeEach()
        {
            inners = Services.CreateMockArrayFor <IContinuation>(5);

            envelope   = new Envelope();
            theContext = new TestEnvelopeContext();

            ClassUnderTest.Execute(envelope, theContext);
        }
        public void SetUp()
        {
            theException = new EnvelopeDeserializationException("foo");
            theContext = new TestEnvelopeContext();

            theEnvelope = ObjectMother.EnvelopeWithSerializationError();

            new DeserializationFailureContinuation(theException)
                .Execute(theEnvelope, theContext);
        }
        public void do_as_a_delay_w_the_timespan_given()
        {
            var continuation = new DelayedRetryContinuation(5.Minutes());
            var context      = new TestEnvelopeContext();

            var envelope = ObjectMother.Envelope();

            continuation.Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MoveToDelayedUntil(context.SystemTime.UtcNow().AddMinutes(5)));
        }
Esempio n. 8
0
        public void SetUp()
        {
            theEnvelope  = ObjectMother.Envelope();
            theException = new NotImplementedException();

            theLogger = MockRepository.GenerateMock <ILogger>();

            theContext = new TestEnvelopeContext();

            new MoveToErrorQueue(theException).Execute(theEnvelope, theContext);
        }
        public void SetUp()
        {
            theEnvelope = ObjectMother.Envelope();
            theException = new NotImplementedException();

            theLogger = MockRepository.GenerateMock<ILogger>();

            theContext = new TestEnvelopeContext();

            new MoveToErrorQueue(theException).Execute(theEnvelope, theContext);
        }
        public void do_as_a_delay_w_the_timespan_given()
        {
            var continuation = new DelayedRetryContinuation(5.Minutes());
            var context = new TestEnvelopeContext();

            var envelope = ObjectMother.Envelope();

            continuation.Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MoveToDelayedUntil(context.SystemTime.UtcNow().AddMinutes(5)));
        }
Esempio n. 11
0
        public void SetUp()
        {
            theException = new EnvelopeDeserializationException("foo");
            theContext   = new TestEnvelopeContext();

            theEnvelope = ObjectMother.EnvelopeWithSerializationError();


            new DeserializationFailureContinuation(theException)
            .Execute(theEnvelope, theContext);
        }
        public void SetUp()
        {
            theException = new Exception();

            theContinuation = new ChainFailureContinuation(theException);

            theEnvelope = ObjectMother.Envelope();

            theContext = new TestEnvelopeContext();

            theContinuation.Execute(theEnvelope, theContext);
        }
        public void just_calls_through_to_the_context_pipeline_to_do_it_again()
        {
            var continuation = new RetryNowContinuation();

            var handlerPipeline = MockRepository.GenerateMock<IHandlerPipeline>();
            var context = new TestEnvelopeContext(handlerPipeline);

            var theEnvelope = ObjectMother.Envelope();
            continuation.Execute(theEnvelope, context);

            handlerPipeline.AssertWasCalled(x => x.Invoke(theEnvelope, context));
        }
        public void SetUp()
        {
            theException = new Exception();

            theContinuation = new ChainFailureContinuation(theException);

            theEnvelope = ObjectMother.Envelope();

            theContext = new TestEnvelopeContext();

            theContinuation.Execute(theEnvelope, theContext);
        }
        public void handle()
        {
            // pretty simple.  Effectively just shuts things down.
            var context = new TestEnvelopeContext();

                        var envelope = ObjectMother.Envelope();
            envelope.ResponseId = Guid.NewGuid().ToString();

            new ResponseEnvelopeHandler().Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MarkSuccessful());
        }
Esempio n. 16
0
        protected override void beforeEach()
        {
            Services.Inject <IEnumerable <IEnvelopeHandler> >(new IEnvelopeHandler[0]);

            theContext = new TestEnvelopeContext();
            Services.Inject <EnvelopeContext>(theContext);

            theEnvelope          = ObjectMother.EnvelopeWithSerializationError();
            theEnvelope.Attempts = 1;

            theEnvelope.Callback = MockFor <IMessageCallback>();
        }
Esempio n. 17
0
        public void just_calls_through_to_the_context_pipeline_to_do_it_again()
        {
            var continuation = new RetryNowContinuation();

            var handlerPipeline = MockRepository.GenerateMock <IHandlerPipeline>();
            var context         = new TestEnvelopeContext(handlerPipeline);

            var theEnvelope = ObjectMother.Envelope();

            continuation.Execute(theEnvelope, context);

            handlerPipeline.AssertWasCalled(x => x.Invoke(theEnvelope, context));
        }
        public void execute_happy_path()
        {
            var context = new TestEnvelopeContext();
            var envelope = ObjectMother.Envelope();
            envelope.ExecutionTime = DateTime.Today;

            new DelayedEnvelopeHandler(null).Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MoveToDelayedUntil(envelope.ExecutionTime.Value));

            context.RecordedLogs.InfoMessages.Single().ShouldBeOfType<DelayedEnvelopeReceived>()
                  .Envelope.ShouldBe(envelope.ToToken());
        }
Esempio n. 19
0
        public void handle()
        {
            // pretty simple.  Effectively just shuts things down.
            var context = new TestEnvelopeContext();

            var envelope = ObjectMother.Envelope();

            envelope.ResponseId = Guid.NewGuid().ToString();

            new ResponseEnvelopeHandler().Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MarkSuccessful());
        }
        public void executing()
        {
            var envelope = ObjectMother.Envelope();
            var context = new TestEnvelopeContext();

            var inner = MockRepository.GenerateMock<IContinuation>();

            var continuation = new AsyncChainExecutionContinuation(() => inner);
            continuation.Execute(envelope, context);

            continuation.Task.Wait(1.Seconds());

            inner.AssertWasCalled(x => x.Execute(envelope, context));
        }
Esempio n. 21
0
        protected override void beforeEach()
        {
            Services.Inject <IEnumerable <IEnvelopeHandler> >(new IEnvelopeHandler[0]);

            MockFor <IEnvelopeHandler>().Stub(x => x.Handle(null)).Return(Task.FromResult <IContinuation>(null)).IgnoreArguments();

            theContext = new TestEnvelopeContext();
            Services.Inject <EnvelopeContext>(theContext);

            theEnvelope          = ObjectMother.EnvelopeWithSerializationError();
            theEnvelope.Attempts = 1;

            theEnvelope.Callback = MockFor <IMessageCallback>();
        }
Esempio n. 22
0
        public void execute_happy_path()
        {
            var context  = new TestEnvelopeContext();
            var envelope = ObjectMother.Envelope();

            envelope.ExecutionTime = DateTime.Today;

            new DelayedEnvelopeHandler(null).Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MoveToDelayedUntil(envelope.ExecutionTime.Value));

            context.RecordedLogs.InfoMessages.Single().ShouldBeOfType <DelayedEnvelopeReceived>()
            .Envelope.ShouldBe(envelope.ToToken());
        }
Esempio n. 23
0
        public void SetUp()
        {
            theEnvelope         = ObjectMother.Envelope();
            theEnvelope.Message = new object();
            theException        = new Exception("Failure");
            theEnvelope.Callback.Stub(x => x.MarkSuccessful()).Throw(theException);

            theEnvelopeContext = new TestEnvelopeContext();

            theContext = new FubuMVC.Core.ServiceBus.Runtime.Invocation.InvocationContext(theEnvelope, new HandlerChain());
            theContext.EnqueueCascading(new object());

            theContinuation = new ChainSuccessContinuation(theContext);
            theContinuation.Execute(theEnvelope, theEnvelopeContext);
        }
Esempio n. 24
0
        public void executing()
        {
            var envelope = ObjectMother.Envelope();
            var context  = new TestEnvelopeContext();

            var inner = MockRepository.GenerateMock <IContinuation>();

            var continuation = new AsyncChainExecutionContinuation(() => inner);

            continuation.Execute(envelope, context);

            continuation.Task.Wait(1.Seconds());

            inner.AssertWasCalled(x => x.Execute(envelope, context));
        }
Esempio n. 25
0
        protected override void beforeEach()
        {
            theHandlers = Services.CreateMockArrayFor <IEnvelopeHandler>(5);

            theContinuation = MockFor <IContinuation>();
            theEnvelope     = ObjectMother.Envelope();

            theHandlers[3].Stub(x => x.Handle(theEnvelope))
            .Return(theContinuation);

            theHandlers[4].Stub(x => x.Handle(theEnvelope))
            .Return(MockRepository.GenerateMock <IContinuation>());

            theContext           = new TestEnvelopeContext();
            theFoundContinuation = ClassUnderTest.FindContinuation(theEnvelope, theContext);
        }
        public void execute_sad_path()
        {
            var context = new TestEnvelopeContext();
            var envelope = ObjectMother.Envelope();
            envelope.ExecutionTime = DateTime.Today;

            var exception = new NotImplementedException();
            envelope.Callback.Stub(x => x.MoveToDelayedUntil(envelope.ExecutionTime.Value)).Throw(exception);

            new DelayedEnvelopeHandler(SystemTime.Default()).Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MarkFailed(exception));

            var report = context.RecordedLogs.ErrorMessages.Single().ShouldBeOfType<FubuCore.Logging.ExceptionReport>();
            report.CorrelationId.ShouldBe(envelope.CorrelationId);
            report.ExceptionText.ShouldBe(exception.ToString());
        }
Esempio n. 27
0
        protected override void beforeEach()
        {
            Services.Inject <IEnumerable <IEnvelopeHandler> >(new IEnvelopeHandler[0]);

            theContext = new TestEnvelopeContext();
            Services.Inject <EnvelopeContext>(theContext);

            theContinuation      = MockFor <IContinuation>();
            theEnvelope          = ObjectMother.Envelope();
            theEnvelope.Attempts = 1;

            theEnvelope.Callback = MockFor <IMessageCallback>();

            Services.PartialMockTheClassUnderTest();
            ClassUnderTest.Expect(x => x.FindContinuation(theEnvelope, theContext))
            .Return(theContinuation);

            ClassUnderTest.Invoke(theEnvelope, theContext);
        }
Esempio n. 28
0
        public void SetUp()
        {
            theEnvelope         = ObjectMother.Envelope();
            theEnvelope.Message = new object();

            theEnvelopeContext = new TestEnvelopeContext();

            theContext = new FubuMVC.Core.ServiceBus.Runtime.Invocation.InvocationContext(theEnvelope, new HandlerChain());

            theContext.EnqueueCascading(new object());
            theContext.EnqueueCascading(new object());
            theContext.EnqueueCascading(new object());

            theSender = new RecordingEnvelopeSender();

            theContinuation = new ChainSuccessContinuation(theContext);

            theLogger = new RecordingLogger();

            theContinuation.Execute(theEnvelope, theEnvelopeContext);
        }
Esempio n. 29
0
        public void execute_sad_path()
        {
            var context  = new TestEnvelopeContext();
            var envelope = ObjectMother.Envelope();

            envelope.ExecutionTime = DateTime.Today;

            var exception = new NotImplementedException();

            envelope.Callback.Stub(x => x.MoveToDelayedUntil(envelope.ExecutionTime.Value)).Throw(exception);

            new DelayedEnvelopeHandler(SystemTime.Default()).Execute(envelope, context);

            envelope.Callback.AssertWasCalled(x => x.MarkFailed(exception));


            var report = context.RecordedLogs.ErrorMessages.Single().ShouldBeOfType <FubuCore.Logging.ExceptionReport>();

            report.CorrelationId.ShouldBe(envelope.CorrelationId);
            report.ExceptionText.ShouldBe(exception.ToString());
        }
        public void SetUp()
        {
            theEnvelope = ObjectMother.Envelope();
            theEnvelope.Message = new object();

            theEnvelopeContext = new TestEnvelopeContext();

            theContext = new FubuMVC.Core.ServiceBus.Runtime.Invocation.InvocationContext(theEnvelope, new HandlerChain());

            theContext.EnqueueCascading(new object());
            theContext.EnqueueCascading(new object());
            theContext.EnqueueCascading(new object());

            theSender = new RecordingEnvelopeSender();

            theContinuation = new ChainSuccessContinuation(theContext);

            theLogger = new RecordingLogger();

            theContinuation.Execute(theEnvelope, theEnvelopeContext);
        }
Esempio n. 31
0
        protected override void beforeEach()
        {
            Services.Inject <IEnumerable <IEnvelopeHandler> >(new IEnvelopeHandler[0]);

            theContext = new TestEnvelopeContext();
            Services.Inject <EnvelopeContext>(theContext);

            theContinuation      = MockFor <IContinuation>();
            theEnvelope          = ObjectMother.Envelope();
            theEnvelope.Attempts = 1;

            theEnvelope.Callback = MockFor <IMessageCallback>();

            Services.PartialMockTheClassUnderTest();
            ClassUnderTest.Expect(x => x.FindContinuation(theEnvelope, theContext))
            .Return(theContinuation.ToCompletionTask());

            MockFor <IEnvelopeLifecycle>().Stub(x => x.StartNew(ClassUnderTest, theEnvelope))
            .Return(theContext);

            ClassUnderTest.Receive(theEnvelope).GetAwaiter().GetResult();
        }
        public void SetUp()
        {
            theEnvelope = ObjectMother.Envelope();
            theEnvelope.Message = new object();
            theException = new Exception("Failure");
            theEnvelope.Callback.Stub(x => x.MarkSuccessful()).Throw(theException);

            theEnvelopeContext = new TestEnvelopeContext();

            theContext = new FubuMVC.Core.ServiceBus.Runtime.Invocation.InvocationContext(theEnvelope, new HandlerChain());
            theContext.EnqueueCascading(new object());

            theContinuation = new ChainSuccessContinuation(theContext);
            theContinuation.Execute(theEnvelope, theEnvelopeContext);
        }