public MessageBusBaseTest()
        {
            _timeZero = DateTimeOffset.Now;
            _timeNow  = _timeZero;

            var messageBusBuilder = new MessageBusBuilder()
                                    .Publish <RequestA>(x =>
            {
                x.DefaultTopic("a-requests");
                x.DefaultTimeout(TimeSpan.FromSeconds(timeoutForA_10));
            })
                                    .Publish <RequestB>(x =>
            {
                x.DefaultTopic("b-requests");
            })
                                    .ExpectRequestResponses(x =>
            {
                x.ReplyToTopic("app01-responses");
                x.DefaultTimeout(TimeSpan.FromSeconds(timeoutDefault_20));
            })
                                    .WithDependencyResolver(new LookupDependencyResolver(t => null))
                                    .WithSerializer(new JsonMessageSerializer())
                                    .WithProvider(s => new MessageBusTested(s));

            _bus = (MessageBusTested)messageBusBuilder.Build();

            // provide current time
            _bus.CurrentTimeProvider = () => _timeNow;
        }
Ejemplo n.º 2
0
        public void Init()
        {
            var messageBusBuilder = new MessageBusBuilder()
                                    .Publish <RequestA>(x =>
            {
                x.DefaultTopic("a-requests");
                x.DefaultTimeout(TimeSpan.FromSeconds(10));
            })
                                    .Publish <RequestB>(x =>
            {
                x.DefaultTopic("b-requests");
            })
                                    .ExpectRequestResponses(x =>
            {
                x.ReplyToTopic("app01-responses");
                x.DefaultTimeout(TimeSpan.FromSeconds(20));
            })
                                    .WithSerializer(new JsonMessageSerializer())
                                    .WithProvider(s => new MessageBusTested(s));

            _bus = (MessageBusTested)messageBusBuilder.Build();

            // provide current time
            _bus.CurrentTimeProvider = () => DateTimeOffset.UtcNow;
        }
Ejemplo n.º 3
0
        public MessageBusBaseTest()
        {
            _timeZero = DateTimeOffset.Now;
            _timeNow  = _timeZero;

            BusBuilder = MessageBusBuilder.Create()
                         .Produce <RequestA>(x =>
            {
                x.DefaultTopic("a-requests");
                x.DefaultTimeout(TimeSpan.FromSeconds(TimeoutForA10));
            })
                         .Produce <RequestB>(x =>
            {
                x.DefaultTopic("b-requests");
            })
                         .ExpectRequestResponses(x =>
            {
                x.ReplyToTopic("app01-responses");
                x.DefaultTimeout(TimeSpan.FromSeconds(TimeoutDefault20));
            })
                         .WithDependencyResolver(new LookupDependencyResolver(t => null))
                         .WithSerializer(new JsonMessageSerializer())
                         .WithProvider(s =>
            {
                var bus = new MessageBusTested(s)
                {
                    // provide current time
                    CurrentTimeProvider = () => _timeNow
                };
                return(bus);
            });

            _busLazy = new Lazy <MessageBusTested>(() => (MessageBusTested)BusBuilder.Build());
        }