예제 #1
0
        protected override Task <BusEventSender> Given()
        {
            _nimbusMessageSender = Substitute.For <INimbusMessageSender>();

            var transport = Substitute.For <INimbusTransport>();

            transport.GetTopicSender(Arg.Any <string>()).Returns(ci => _nimbusMessageSender);

            var clock = new SystemClock();
            var replyQueueNameSetting = new ReplyQueueNameSetting(
                new ApplicationNameSetting {
                Value = "TestApplication"
            },
                new InstanceNameSetting {
                Value = "TestInstance"
            });
            var nimbusMessageFactory = new NimbusMessageFactory(new DefaultMessageTimeToLiveSetting(),
                                                                replyQueueNameSetting,
                                                                clock,
                                                                new DispatchContextManager());
            var logger = Substitute.For <ILogger>();
            var knownMessageTypeVerifier = Substitute.For <IKnownMessageTypeVerifier>();
            var router                     = new DestinationPerMessageTypeRouter();
            var dependencyResolver         = new NullDependencyResolver();
            var outboundInterceptorFactory = new NullOutboundInterceptorFactory();
            var busCommandSender           = new BusEventSender(dependencyResolver,
                                                                knownMessageTypeVerifier,
                                                                logger,
                                                                nimbusMessageFactory,
                                                                transport,
                                                                outboundInterceptorFactory,
                                                                router);

            return(Task.FromResult(busCommandSender));
        }
예제 #2
0
        protected override Task <BusCommandSender> Given()
        {
            _nimbusMessageSender = Substitute.For <INimbusMessageSender>();

            var messagingFactory = Substitute.For <INimbusMessagingFactory>();

            messagingFactory.GetQueueSender(Arg.Any <string>()).Returns(ci => _nimbusMessageSender);

            var clock                 = new SystemClock();
            var typeProvider          = new TestHarnessTypeProvider(new[] { GetType().Assembly }, new[] { GetType().Namespace });
            var serializer            = new DataContractSerializer(typeProvider);
            var replyQueueNameSetting = new ReplyQueueNameSetting(
                new ApplicationNameSetting {
                Value = "TestApplication"
            },
                new InstanceNameSetting {
                Value = "TestInstance"
            });
            var brokeredMessageFactory = new BrokeredMessageFactory(new DefaultMessageTimeToLiveSetting(),
                                                                    new MaxLargeMessageSizeSetting(),
                                                                    new MaxSmallMessageSizeSetting(),
                                                                    replyQueueNameSetting,
                                                                    clock,
                                                                    new NullCompressor(),
                                                                    new DispatchContextManager(),
                                                                    new UnsupportedLargeMessageBodyStore(),
                                                                    serializer,
                                                                    typeProvider);
            var logger = Substitute.For <ILogger>();
            var knownMessageTypeVerifier = Substitute.For <IKnownMessageTypeVerifier>();
            var router                     = new DestinationPerMessageTypeRouter();
            var dependencyResolver         = new NullDependencyResolver();
            var outboundInterceptorFactory = new NullOutboundInterceptorFactory();

            var busCommandSender = new BusCommandSender(brokeredMessageFactory,
                                                        dependencyResolver,
                                                        knownMessageTypeVerifier,
                                                        logger,
                                                        messagingFactory,
                                                        outboundInterceptorFactory,
                                                        router);

            return(Task.FromResult(busCommandSender));
        }