public void ShouldReturnDatabaseQueueWriter()
        {
            var result = _target.BeginWrite(_key);

            result.Should().NotBeNull();
            result.Should().BeOfType <DatabaseQueueWriter>();
        }
        public void Publish(Event eventToPublish)
        {
            if (eventToPublish == null)
            {
                throw new ArgumentNullException(nameof(eventToPublish));
            }

            using (var sendAction = _messageQueue.BeginWrite(MessageQueueKeys.Events))
            {
                var serializedEvent = eventToPublish.ToXml();

                sendAction.Send(serializedEvent);
            }
        }
示例#3
0
        public void Publish(Notification notification)
        {
            _notificationValidator.Validate(notification);

            using (var writeAction = _messageQueue.BeginWrite(Key))
            {
                var serializedNotification = notification.ToXml();

                writeAction.Send(serializedNotification);

                _log.Debug(Properties.Resources.NotificationHasBeenPublished.FormatWith(
                               notification.Title,
                               notification.Protocol,
                               notification.Targets.ToCommaSeparatedString()));
            }
        }
        public void ShouldWriteMessage()
        {
            using (var writeAction = _target.BeginWrite(MessageQueueKeys.Notifications))
            {
                using (_unitOfWork.BeginTransaction())
                {
                    writeAction.Send("hello");
                }

                _unitOfWork.Reset();

                using (var trans = _unitOfWork.BeginTransaction())
                {
                    writeAction.Send("hello2");

                    _unitOfWork.Commit();

                    trans.Commit();
                }
            }
        }