public override void ConfigureServices(IServiceCollection serviceCollection)
        {
            var configuration    = ApplicationSettingsConfigurationProvider.Get();
            var rabbitMqSettings = configuration.GetSection("Bus").Get <PublisherRabbitMqSettings>();

            EventsPublisherBuilder
            .Create(serviceCollection)
            .WithSettings(configuration.GetSection("Settings").Get <EventsPublisherSettings>())
            .WithDbContext <MonolithDbContext>()
            .WithTransactionProvider <MonolithDbContext>()
            .WithEventsFromAssemblyOfType <RegistrationPaid>()
            .WithEventsFromAssemblyOfType <LocationAdded>()
            .WithEventsFromAssemblyOfType <ExamPlanned>()
            .WithPersistence(services =>
            {
                services.AddPersistence(
                    configuration.GetConnectionString("Database"),
                    configuration.GetConnectionString("Database"));
                services.TryAddTransient <ISystemTimeProvider, SystemTimeProvider>();
            })
            .ToRabbitMq(rabbitMqSettings)
            .Build();

            serviceCollection.AddHealthChecks()
            .AddSqlServer(configuration.GetConnectionString("Database"))
            .AddRabbitMQ(rabbitConnectionString: RabbitMqConnectionStringBuilder.Build(rabbitMqSettings.Host,
                                                                                       rabbitMqSettings.Username, rabbitMqSettings.Password));
        }
        public void ShouldReturnCorrectRabbitMqConnectionStringForHostWithoutProtocol()
        {
            var host     = "localhost:15672";
            var username = "******";
            var password = "******";

            var connectionString = RabbitMqConnectionStringBuilder.Build(host, username, password);

            connectionString.Should()
            .Be(
                $"{RabbitMqConnectionStringBuilder.DefaultProtocol}://{username}:{password}@{host}/{RabbitMqConnectionStringBuilder.DefaultVirtualHost}");
        }
        public override void ConfigureServices(IServiceCollection serviceCollection)
        {
            var configuration    = ApplicationSettingsConfigurationProvider.Get();
            var rabbitMqSettings = configuration.GetSection("Bus").Get <ConsumerRabbitMqSettings>();

            EventsConsumerBuilder
            .Create(serviceCollection)
            .WithHandlersFromAssemblyOfType <OnLocationAdded>()
            .WithServices(services =>
            {
                services.AddPersistence(
                    configuration.GetConnectionString("Database"),
                    configuration.GetConnectionString("Database"));
                services.AddInbox <MonolithDbContext>();
                services.AddMemoryCache();
            })
            .ToRabbitMq(rabbitMqSettings)
            .Build();

            serviceCollection.AddHealthChecks()
            .AddSqlServer(configuration.GetConnectionString("Database"))
            .AddRabbitMQ(rabbitConnectionString: RabbitMqConnectionStringBuilder.Build(rabbitMqSettings.Host,
                                                                                       rabbitMqSettings.Username, rabbitMqSettings.Password));
        }