Пример #1
0
        /// <summary>
        /// Execute the job.
        /// </summary>
        public void Execute()
        {
            try
            {
                InitExecutionContext();

                _moduleManager.OnStart();
                var handlers = _handlerCreator.Create(_message);

                foreach (var handler in handlers)
                {
                    handler.Handle(_message);

                    if (_context.DoNotContinueDispatchingCurrentMessageToHandlers)
                    {
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(string.Format("Error handling message {0}.", typeof(TMessage).Name), ex);
                _moduleManager.OnError(ex);
            }
            finally
            {
                _moduleManager.OnFinished();
            }
        }
        public void Create_NullMessage_ReturnsNotNull()
        {
            // given
            object msg = null;

            // when
            var retVal = _sut.Create(msg);

            // then
            Assert.That(retVal, Is.Not.Null);
        }