public void Should_publish_price_updates_for_each_market_when_updates_exists()
        {
            // Arrange
            var article1 = new ArticleForPriceUpdate("181", string.Empty, "DK");
            var article2 = new ArticleForPriceUpdate("100", string.Empty, "NO");
            var article3 = new ArticleForPriceUpdate("100", string.Empty, "SE");
            var articlesForPriceUpdates = new List<ArticleForPriceUpdate>
            {
                article1,
                article2,
                article3
            };
            _priceUpdateQuery.Setup(x => x.GetArticlesForPriceUpdate(_timeOfLastQuery)).Returns(articlesForPriceUpdates);

            // Act
            _task.Execute();

            // Assert
            _pimCommandService.Verify(x => x.PublishPriceUpdate(_settings.Markets[0].MarketKey, It.IsAny<ArticleForPriceAndStockUpdate>()), Times.AtLeastOnce());
            _pimCommandService.Verify(x => x.PublishPriceUpdate(_settings.Markets[1].MarketKey, It.IsAny<ArticleForPriceAndStockUpdate>()), Times.AtLeastOnce());
            _pimCommandService.Verify(x => x.PublishPriceUpdate(_settings.Markets[2].MarketKey, It.IsAny<ArticleForPriceAndStockUpdate>()), Times.AtLeastOnce());
        }
예제 #2
0
 private static ArticleForPriceAndStockUpdate MapToArticleForPriceAndStockUpdate(ArticleForPriceUpdate source)
 {
     return  new ArticleForPriceAndStockUpdate
     {
         ArticleNo = source.ArticleNo,
         PimSku = source.PimSku,
         Price = source.NewPrice
     };
 }