예제 #1
0
        public void Should_get_pending_scheduled_messages_and_update_them()
        {
            var pendingSchedule = new List <ScheduleMe>
            {
                new ScheduleMe {
                    BindingKey = "msg1"
                },
                new ScheduleMe {
                    BindingKey = "msg2"
                },
            };

            scheduleRepository.Stub(x => x.GetPending()).Return(pendingSchedule);

            schedulerService.OnPublishTimerTick(null);

            advancedBus.AssertWasCalled(x => x.Publish(
                                            Arg <Exchange> .Is.Anything,
                                            Arg <string> .Is.Equal("msg1"),
                                            Arg <bool> .Is.Anything,
                                            Arg <bool> .Is.Anything,
                                            Arg <MessageProperties> .Is.Anything,
                                            Arg <byte[]> .Is.Anything));

            advancedBus.AssertWasCalled(x => x.Publish(
                                            Arg <Exchange> .Is.Anything,
                                            Arg <string> .Is.Equal("msg2"),
                                            Arg <bool> .Is.Anything,
                                            Arg <bool> .Is.Anything,
                                            Arg <MessageProperties> .Is.Anything,
                                            Arg <byte[]> .Is.Anything));
        }
예제 #2
0
        public void Should_declare_exchange_the_first_time_declare_is_called()
        {
            var declaredExchange = publishExchangeDeclareStrategy.DeclareExchange(advancedBus, exchangeName, ExchangeType.Topic);

            advancedBus.AssertWasCalled(x => x.ExchangeDeclare(exchangeName, "topic"));
            declaredExchange.ShouldBeTheSameAs(exchange);
            exchangeDeclareCount.ShouldEqual(1);
        }
예제 #3
0
        public void Should_get_pending_scheduled_messages_and_update_them()
        {
            var id = Guid.NewGuid();

            scheduleRepository.Stub(x => x.GetPending()).Return(new Schedule
            {
                Id         = id,
                BindingKey = "msg1"
            });

            schedulerService.OnPublishTimerTick(null);

            scheduleRepository.AssertWasCalled(x => x.MarkAsPublished(id));
            advancedBus.AssertWasCalled(x => x.Publish(
                                            Arg <Exchange> .Is.Anything,
                                            Arg <string> .Is.Equal("msg1"),
                                            Arg <bool> .Is.Anything,
                                            Arg <MessageProperties> .Is.Anything,
                                            Arg <byte[]> .Is.Anything));
        }