Example #1
0
 private void LogRequest(int messageId, string primaryAction, string secondaryAction, object queryItem)
 {
     _pimRequestLogRepository.LogEnqueuedRequest(new EnqueuedRequest
     {
         MessageId       = messageId,
         EnqueuedAt      = DateTime.Now,
         PrimaryAction   = primaryAction,
         SecondaryAction = secondaryAction,
         RequestItem     = queryItem
     });
 }
        public void Should_log_enqueued_pim_request()
        {
            // Arrange
            var messageResult = new EnqueuedRequest
            {
                MessageId       = _enqueuedRequestMessageId,
                PrimaryAction   = "TestPrimary",
                SecondaryAction = "TestSecondary",
                RequestItem     = new ProductQueryRequestItem {
                    CreatedOn = DateTime.Now
                },
                EnqueuedAt = DateTime.Now
            };

            // Act
            _repository.LogEnqueuedRequest(messageResult);

            // Assert
            var lastMessages = _repository.GetRecentRequests(2);

            Assert.That(lastMessages.Any(msg => msg.MessageId == _enqueuedRequestMessageId), Is.True);
        }