Example #1
0
        public async Task GivenAnItemId_ThenCorrectRequestIsMadeToRetrieveItem(string id, string typeOfItem)
        {
            var queueItem = new QueueItem {
                Id = id
            };
            var message = new CloudQueueMessage(JsonConvert.SerializeObject(queueItem));

            var fileLoaderMessageHandler = new FileLoaderMessageHandler(typeOfItem, "Amazon");

            GetAmazonPriceFunction.Client = new HttpClient(fileLoaderMessageHandler);
            await GetAmazonPriceFunction.Run(message, _tableReference);

            var requests = fileLoaderMessageHandler.GetRequests();

            Assert.Contains($"https://www.amazon.co.uk/dp/{id}", requests);
        }
Example #2
0
        public async Task GivenAnItemId_ThenCorrectRequestIsMadeToRetrieveItem()
        {
            const string itemId = "8665454";

            var queueItem = new QueueItem {
                Id = itemId
            };
            var message = new CloudQueueMessage(JsonConvert.SerializeObject(queueItem));

            var fileLoaderMessageHandler = new FileLoaderMessageHandler("Item", "Argos");

            GetArgosPriceFunction.Client = new HttpClient(fileLoaderMessageHandler);
            await GetArgosPriceFunction.Run(message, _tableReference);

            var requests = fileLoaderMessageHandler.GetRequests();

            Assert.Contains($"https://www.argos.co.uk/product/{itemId}", requests);
        }