Esempio n. 1
0
        public void Arrange()
        {
            _messageSubscriber        = new Mock <IMessageSubscriber <MessageType> >();
            _messageSubscriberFactory = new Mock <IMessageSubscriberFactory>();
            _messageContextProvider   = new Mock <IMessageContextProvider>();
            _logger = new Mock <ILog>();

            _messageSubscriberFactory.Setup(x => x.GetSubscriber <MessageType>()).Returns(_messageSubscriber.Object);

            _messageProcessor = new TestMessageProcessor(_messageSubscriberFactory.Object, _logger.Object, _messageContextProvider.Object);
        }
Esempio n. 2
0
        public void TestExceptionCallbackUsed()
        {
            var mockAdapter = Mock.Of <IMongoDbAdapter>();

            var callbackUsed = false;
            Action <Exception> exceptionCallback = (exception) => { callbackUsed = true; };

            _helper.Globals.MongoDbPopulatorOptions.MongoDbFlushTime = 1;

            var processor = new TestMessageProcessor(_helper.Globals.MongoDbPopulatorOptions, mockAdapter, 1, exceptionCallback);

            Assert.False(processor.IsStopping);

            Thread.Sleep((_helper.Globals.MongoDbPopulatorOptions.MongoDbFlushTime * 1000) + 100);

            Assert.True(callbackUsed);
            Assert.True(processor.IsStopping);
        }