public void ShouldReturnDatabaseQueueReader()
        {
            var result = _target.BeginRead(_key);

            result.Should().NotBeNull();
            result.Should().BeOfType <DatabaseQueueReader>();
        }
        public void ShouldReceiveMessage()
        {
            using (var writeAction = _target.BeginRead(MessageQueueKeys.Notifications))
            {
                var result = writeAction.Read();

                _unitOfWork.Commit();

                result.Should().NotBeNullOrEmpty();
            }
        }
        public Event GetNext()
        {
            using (var readAction = _messageQueue.BeginRead(MessageQueueKeys.Events))
            {
                var eventMessage = readAction.Read();

                if (string.IsNullOrEmpty(eventMessage))
                {
                    return(null);
                }

                var nextEvent = eventMessage.FromXml <Event>();

                return(nextEvent);
            }
        }
示例#4
0
        public Notification GetNext()
        {
            using (var readAction = _messageQueue.BeginRead(Key))
            {
                var notificationMessage = readAction.Read();

                if (string.IsNullOrEmpty(notificationMessage))
                {
                    _log.Debug(Properties.Resources.ThereIsNoOneUnprocessedNotificationInQueue);

                    return(null);
                }

                var nextNotification = notificationMessage.FromXml <Notification>();

                _log.Debug(Properties.Resources.NotificationHasBeenReadFromQueue.FormatWith(
                               nextNotification.Title,
                               nextNotification.Protocol,
                               nextNotification.Targets.ToCommaSeparatedString()));

                return(nextNotification);
            }
        }