示例#1
0
        public ConsumerHostServices(IConfiguration configuration, ISaveData saveData, IHostApplicationLifetime appLifetime, ILogger <ConsumerHostServices> logger)
        {
            _logger      = logger;
            _appLifetime = appLifetime;
            IFactoryClient factory = new FactoryClient(configuration, saveData, _logger);

            _client = factory.CreateMessageQueue(configuration["MessageQueue:Type"]);
        }
示例#2
0
        public void CreateMessageQueue_StateUnderTest_ExpectedBehavior(string type, string typeName)
        {
            //Arrange
            Mock <IConfiguration> config = _mockRepository.Create <IConfiguration>();
            string connectString         = _fixture.Create <string>();
            string queueName             = _fixture.Create <string>();

            config.Setup(x => x[$"{type}:ConnectionString"]).Returns(connectString);
            config.Setup(x => x[$"{type}:QueueName"]).Returns(queueName);
            var factory = new FactoryClient(config.Object);
            //Act
            var result = factory.CreateMessageQueue(type);

            //Assert
            Assert.StartsWith(typeName, result.GetType().Name);
            this._mockRepository.VerifyAll();
        }