public void Enabling_performance_counters_should_result_in_performance_counters_being_created()
        {
            //This will delete an recreate the categories.
            PerformanceCategoryCreator.CreateCategories();

            var outboundIntances = new PerformanceCounterCategory(OutboundPerfomanceCounters.CATEGORY).GetInstanceNames();
            var inboundIntances = new PerformanceCounterCategory(InboundPerfomanceCounters.CATEGORY).GetInstanceNames();
            Assert.Empty(outboundIntances);
            Assert.Empty(inboundIntances);

            var hostConfiguration = new RhinoQueuesHostConfiguration()
                .EnablePerformanceCounters()
                .Bus("rhino.queues://localhost/test_queue2", "test");

            container = new WindsorContainer();
            new RhinoServiceBusConfiguration()
                .UseConfiguration(hostConfiguration.ToBusConfiguration())
                .UseCastleWindsor(container)
                .Configure();
            bus = container.Resolve<IStartableServiceBus>();
            bus.Start();

            using (var tx = new TransactionScope())
            {
                bus.Send(bus.Endpoint, "test message.");
                tx.Complete();
            }

            outboundIntances = new PerformanceCounterCategory(OutboundPerfomanceCounters.CATEGORY).GetInstanceNames();
            inboundIntances = new PerformanceCounterCategory(InboundPerfomanceCounters.CATEGORY).GetInstanceNames();

            Assert.NotEmpty(outboundIntances.Where(name => name.Contains("test_queue2")));
            Assert.NotEmpty(inboundIntances.Where(name => name.Contains("test_queue2")));
        }
        public UsingRhinoQueuesBusWithAlternateStorageLocation()
        {
            defaultStorageLocation = Directory.GetCurrentDirectory();
            alternateStorageLocation = Path.Combine(Directory.GetCurrentDirectory(), "Alternate");

            storageDirectories = new[] { "test.esent", "test_subscriptions.esent" };

            if (Directory.Exists(alternateStorageLocation))
                Directory.Delete(alternateStorageLocation, true);

            foreach (var expectedSubDirectory in storageDirectories.Select(d => Path.Combine(defaultStorageLocation, d)))
            {
                if (Directory.Exists(expectedSubDirectory))
                    Directory.Delete(expectedSubDirectory, true);
            }

            var hostConfiguration = new RhinoQueuesHostConfiguration()
                .StoragePath(alternateStorageLocation)
                .Bus("rhino.queues://localhost/test_queue2", "test")
                .Receive("Rhino.ServiceBus.Tests", "rhino.queues://localhost/test_queue");

            container = new WindsorContainer();
            new RhinoServiceBusConfiguration()
                .UseConfiguration(hostConfiguration.ToBusConfiguration())
                .UseCastleWindsor(container)
                .Configure();
            bus = container.Resolve<IStartableServiceBus>();
            bus.Start();
        }
        public UsingOneWayBusWithBusNameSpecified()
        {
            baseStorageLocation = Directory.GetCurrentDirectory();

            defaultOneWayDirectory = Path.Combine(baseStorageLocation, DEFAULT_STORAGE_DIRECTORY);
            if (Directory.Exists(defaultOneWayDirectory))
                Directory.Delete(defaultOneWayDirectory, true);

            alternateOneWayDirectory = Path.Combine(baseStorageLocation, ALTERNATE_STORAGE_DIRECTORY);
            if (Directory.Exists(alternateOneWayDirectory))
                Directory.Delete(alternateOneWayDirectory, true);

            var hostConfiguration = new RhinoQueuesHostConfiguration()
                .Bus(null, ALTERNATE_BUS_NAME)
                .Receive("System.string", "rhino.queues://nowhere/no_queue");

            container = new WindsorContainer();
            new OnewayRhinoServiceBusConfiguration()
                .UseConfiguration(hostConfiguration.ToBusConfiguration())
                .UseCastleWindsor(container)
                .Configure();
            container.Resolve<IOnewayBus>();
        }
        public UsingOneWayBusWithAlternateStorageLocation()
        {
            defaultStorageLocation = Directory.GetCurrentDirectory();
            alternateStorageLocation = Path.Combine(Directory.GetCurrentDirectory(), "Alternate");

            if (Directory.Exists(alternateStorageLocation))
                Directory.Delete(alternateStorageLocation, true);

            var defaultOneWayDirectory = Path.Combine(defaultStorageLocation, storageDirectory);
            if (Directory.Exists(defaultOneWayDirectory))
                Directory.Delete(defaultOneWayDirectory, true);

            var hostConfiguration = new RhinoQueuesHostConfiguration()
                .StoragePath(alternateStorageLocation)
                .Receive("System.string", "rhino.queues://nowhere/no_queue");

            container = new WindsorContainer();
            new OnewayRhinoServiceBusConfiguration()
                .UseConfiguration(hostConfiguration.ToBusConfiguration())
                .UseCastleWindsor(container)
                .Configure();
            container.Resolve<IOnewayBus>();
        }