Esempio n. 1
0
        public void SubmitNextFeedInQueueToAmazon(IFeedSubmissionEntryService feedSubmissionService)
        {
            var feedSubmission = feedSubmissionService.GetNextFromQueueOfFeedsToSubmit(_merchantId, _region);

            if (feedSubmission == null)
            {
                return;
            }

            _feedSubmissionProcessor.SubmitFeedToAmazon(feedSubmissionService, feedSubmission);
        }
Esempio n. 2
0
        GetNextFromQueueOfFeedsToSubmit_ReturnsFirstFeedSubmissionFromQueueWithNullFeedSubmissionId_AndSkipsEntriesWithNonNullFeedSubmissionId()
        {
            var propertiesContainer           = new FeedSubmissionPropertiesContainer("testFeedContent", "testFeedType");
            var serializedPropertiesContainer = JsonConvert.SerializeObject(propertiesContainer);

            var feedSubmissionWithNonNullFeedSubmissionId1 = new FeedSubmissionEntry(serializedPropertiesContainer)
            {
                AmazonRegion             = AmazonRegion.Europe,
                MerchantId               = _merchantId,
                Id                       = 2,
                FeedSubmissionId         = "testSubmissionId2",
                FeedSubmissionRetryCount = 0
            };
            var feedSubmissionWithNullFeedSubmissionId1 = new FeedSubmissionEntry(serializedPropertiesContainer)
            {
                AmazonRegion             = AmazonRegion.Europe,
                MerchantId               = _merchantId,
                Id                       = 3,
                FeedSubmissionId         = null,
                FeedSubmissionRetryCount = 0
            };
            var feedSubmissionWithNullFeedSubmissionId2 = new FeedSubmissionEntry(serializedPropertiesContainer)
            {
                AmazonRegion             = AmazonRegion.Europe,
                MerchantId               = _merchantId,
                Id                       = 4,
                FeedSubmissionId         = null,
                FeedSubmissionRetryCount = 0
            };


            _feedSubmissionEntries.Add(feedSubmissionWithNonNullFeedSubmissionId1);
            _feedSubmissionEntries.Add(feedSubmissionWithNullFeedSubmissionId1);
            _feedSubmissionEntries.Add(feedSubmissionWithNullFeedSubmissionId2);

            var feedSubmissionCallback =
                _feedSubmissionEntryService.GetNextFromQueueOfFeedsToSubmit(_merchantId, _region);

            Assert.IsNotNull(feedSubmissionCallback);
            Assert.AreEqual(feedSubmissionWithNullFeedSubmissionId1.Id, feedSubmissionCallback.Id);
        }