public void CanStartMessageBroker()
        {
            var queueFactory = Substitute.For<IQueueFactory>();
            var messageBrokerConfig = new MessageBrokerConfig { RemoteQueueName = "MyRemoteQueueName", ServiceName = "TestBroker" };
            var entityConnectionConfig = new EntityConnectionConfig(new DatabaseConnectionConfig("(localdb)\\MSSQLLocalDB", "ABJA_Ripples"));
            var logger = NullLogger.Instance;
            var repositoryContextFactory = new RepositoryContextFactory(logger, entityConnectionConfig);
            var queueHandlerFactory = new QueueHandlerFactory(logger, queueFactory);
            var processInformation = new ProcessInformation();

            using (var messageBroker = new MessageBroker(logger, messageBrokerConfig, repositoryContextFactory, queueHandlerFactory, queueFactory, processInformation))
            {
                var cancellationToken = new CancellationToken();
                messageBroker.Start(cancellationToken);

                messageBroker.Handler(new MessageBusServiceHandshakeMessage
                {
                    ServiceName = "MyServiceName",
                    ServerName = "MyTestServer",
                    ReplyQueue = "MyQueue",
                    SendDateTime = DateTimeOffset.Now,
                    SubscribeHandlers = new List<SubscribeHandler> { new SubscribeHandler { Name = "MySubscriber", QueueName = "MyQueue", Durable = true, MessageType = "string", Topic = "MyTopic" } }
                });
            }
        }
 public MessageStateRepositoryTests()
 {
     _messageId                = UniqueKeyUtility.Generate();
     _subscriberName           = UniqueKeyUtility.Generate();
     _entityConnectionConfig   = new EntityConnectionConfig(new DatabaseConnectionConfig(@"(localdb)\MSSQLLocalDB", "Grumpy.RipplesMQ.Database_Model"));
     _repositoryContextFactory = new RepositoryContextFactory(NullLogger.Instance, _entityConnectionConfig);
 }
        public FeatureToggleIntegrationTests()
        {
            var logger = NullLogger.Instance;

            var entityConnectionConfig   = new EntityConnectionConfig(new DatabaseConnectionConfig(@"(localdb)\MSSQLLocalDB", "Grumpy.FeatureToggle.Database_Model"));
            var repositoryContextFactory = new RepositoryContextFactory(logger, entityConnectionConfig);
            var messageBusBuilder        = new MessageBusBuilder();

            var messageBus = messageBusBuilder.Build();

            _cut = new Core.FeatureToggle(logger, messageBus, repositoryContextFactory);

            messageBus.Start(new CancellationToken());
        }
        protected override void Process(CancellationToken cancellationToken)
        {
            Logger = new ConsoleLogger(ServiceName, (message, level) => level >= _logLevel, false);

            var appSettings = ConfigurationManager.AppSettings;

            Enum.TryParse(appSettings["LogLevel"], true, out _logLevel);

            var entityConnectionConfig   = new EntityConnectionConfig(new DatabaseConnectionConfig(appSettings["DatabaseServer"], appSettings["DatabaseName"]));
            var repositoryContextFactory = new RepositoryContextFactory(Logger, entityConnectionConfig);
            var messageBusBuilder        = new MessageBusBuilder();

            messageBusBuilder.WithLogger(Logger);
            messageBusBuilder.WithServiceName(ServiceName);

            _messageBus = messageBusBuilder.Build();

            _featureToggle = new Core.FeatureToggle(Logger, _messageBus, repositoryContextFactory);

            _messageBus.Start(cancellationToken);
        }