コード例 #1
0
        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
 public override void TestFixtureTearDown()
 {
     Subject.Stop().Wait();
     _dependencyResolver = null;
     base.TestFixtureTearDown();
     if (Directory.Exists(_largeMessageBodyTempPath))
     {
         Directory.Delete(_largeMessageBodyTempPath, true);
     }
 }