protected override async Task <Bus> Given()
        {
            _largeMessageBodyTempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Guid.NewGuid().ToString());

            _fakeHandler        = new FakeHandler(NumMessagesToSend);
            _dependencyResolver = new FakeDependencyResolver(_fakeHandler);
            _timeout            = TimeSpan.FromSeconds(300); //FIXME set to 30 seconds
            _typeProvider       = new TestHarnessTypeProvider(new[] { GetType().Assembly }, new[] { GetType().Namespace });

            _logger = TestHarnessLoggerFactory.Create();
            //_logger = new NullLogger();

            var largeMessageBodyStorage = new FileSystemStorageBuilder().Configure()
                                          .WithStorageDirectory(_largeMessageBodyTempPath)
                                          .WithLogger(_logger)
                                          .Build();

            var bus = new BusBuilder().Configure()
                      .WithNames("ThroughputTestSuite", Environment.MachineName)
                      .WithLogger(_logger)
                      .WithConnectionString(CommonResources.ServiceBusConnectionString)
                      .WithTypesFrom(_typeProvider)
                      .WithDependencyResolver(_dependencyResolver)
                      .WithLargeMessageStorage(c => c.WithLargeMessageBodyStore(largeMessageBodyStorage)
                                               .WithMaxSmallMessageSize(4096))
                      .WithDebugOptions(dc => dc.RemoveAllExistingNamespaceElementsOnStartup(
                                            "I understand this will delete EVERYTHING in my namespace. I promise to only use this for test suites."))
                      .Build();
            await bus.Start();

            return(bus);
        }
示例#2
0
        protected override async Task <Bus> Given()
        {
            _largeMessageBodyTempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Guid.NewGuid().ToString());

            var typeProvider = new TestHarnessTypeProvider(new[] { GetType().Assembly }, new[] { GetType().Namespace });
            var logger       = TestHarnessLoggerFactory.Create();

            logger.Debug("Starting disk storage large message test at {0}", _largeMessageBodyTempPath);

            var largeMessageBodyStorage = new FileSystemStorageBuilder().Configure()
                                          .WithStorageDirectory(_largeMessageBodyTempPath)
                                          .WithLogger(logger)
                                          .Build();

            var bus = new BusBuilder().Configure()
                      .WithNames("MyTestSuite", Environment.MachineName)
                      .WithConnectionString(CommonResources.ServiceBusConnectionString)
                      .WithTypesFrom(typeProvider)
                      .WithDefaultTimeout(TimeSpan.FromSeconds(10))
                      .WithLogger(logger)
                      .WithLargeMessageStorage(c => c.WithLargeMessageBodyStore(largeMessageBodyStorage)
                                               .WithMaxSmallMessageSize(64 * 1024)
                                               .WithMaxLargeMessageSize(10 * 1048576))
                      .WithDebugOptions(dc => dc.RemoveAllExistingNamespaceElementsOnStartup(
                                            "I understand this will delete EVERYTHING in my namespace. I promise to only use this for test suites."))
                      .Build();
            await bus.Start();

            logger.Debug("Bus started");
            return(bus);
        }