Exemplo n.º 1
0
        public void RequestFeedSubmissionStatusesFromAmazon(IFeedSubmissionEntryService feedSubmissionService)
        {
            var feedSubmissionIds = feedSubmissionService.GetIdsForSubmittedFeedsFromQueue(_merchantId, _region).ToList();

            if (!feedSubmissionIds.Any())
            {
                return;
            }

            var feedSubmissionResults = _feedSubmissionProcessor.RequestFeedSubmissionStatusesFromAmazon(feedSubmissionService, feedSubmissionIds, _merchantId);

            if (feedSubmissionResults != null)
            {
                _feedSubmissionProcessor.QueueFeedsAccordingToProcessingStatus(feedSubmissionService, feedSubmissionResults);
            }

            _feedSubmissionProcessor.UnlockFeedSubmissionEntries(feedSubmissionService, feedSubmissionIds);
        }
Exemplo n.º 2
0
        public void GetAllSubmittedFeedsFromQueue_ReturnsListOfSubmittedFeeds_ForGivenMerchant()
        {
            // Arrange
            var propertiesContainer           = new FeedSubmissionPropertiesContainer("testFeedContent", "testFeedType");
            var serializedPropertiesContainer = JsonConvert.SerializeObject(propertiesContainer);
            var testMerchantId2 = "test merchant id 2";
            var data            = new List <FeedSubmissionEntry>
            {
                new FeedSubmissionEntry(serializedPropertiesContainer)
                {
                    AmazonRegion         = AmazonRegion.Europe,
                    MerchantId           = testMerchantId2,
                    Id                   = 2,
                    FeedSubmissionId     = "FeedSubmissionId2",
                    IsProcessingComplete = false
                },
                new FeedSubmissionEntry(serializedPropertiesContainer)
                {
                    AmazonRegion         = AmazonRegion.Europe,
                    MerchantId           = testMerchantId2,
                    Id                   = 3,
                    FeedSubmissionId     = "FeedSubmissionId3",
                    IsProcessingComplete = false
                },
                new FeedSubmissionEntry(serializedPropertiesContainer)
                {
                    AmazonRegion         = AmazonRegion.Europe,
                    MerchantId           = _merchantId,
                    Id                   = 4,
                    FeedSubmissionId     = "FeedSubmissionId4",
                    IsProcessingComplete = false
                },
                new FeedSubmissionEntry(serializedPropertiesContainer)
                {
                    AmazonRegion         = AmazonRegion.Europe,
                    MerchantId           = _merchantId,
                    Id                   = 5,
                    FeedSubmissionId     = "FeedSubmissionId5",
                    IsProcessingComplete = false
                },
                new FeedSubmissionEntry(serializedPropertiesContainer)
                {
                    AmazonRegion         = AmazonRegion.Europe,
                    MerchantId           = _merchantId,
                    Id                   = 6,
                    FeedSubmissionId     = null,
                    IsProcessingComplete = false
                },
                new FeedSubmissionEntry(serializedPropertiesContainer)
                {
                    AmazonRegion         = AmazonRegion.Europe,
                    MerchantId           = _merchantId,
                    Id                   = 7,
                    FeedSubmissionId     = "FeedSubmissionId7",
                    IsProcessingComplete = true
                },
                new FeedSubmissionEntry(serializedPropertiesContainer)
                {
                    AmazonRegion         = AmazonRegion.NorthAmerica,
                    MerchantId           = _merchantId,
                    Id                   = 8,
                    FeedSubmissionId     = "FeedSubmissionId8",
                    IsProcessingComplete = false
                }
            };

            _feedSubmissionEntries.AddRange(data);

            // Act
            var listSubmittedFeeds = _feedSubmissionEntryService.GetIdsForSubmittedFeedsFromQueue(_merchantId, _region);

            // Assert
            Assert.AreEqual(2, listSubmittedFeeds.Count());
            Assert.IsTrue(listSubmittedFeeds.Count(sf => sf == "FeedSubmissionId4" || sf == "FeedSubmissionId5") == 2);
        }