Exemplo n.º 1
0
        public async Task GetBestDeal_ShouldReturnBestDeal()
        {
            var request = new BestOfferRequest
            {
                Source      = "S1",
                Destination = "D1",
                Carton      = new int[] { 4, 4, 4 }
            };

            var response = new BestOfferResponse {
                CompanyName = "FedX", BestPrice = 110
            };

            _offersService.Setup(offerService => offerService.GetBestDealAsync(request)).ReturnsAsync(response);


            int expectedResult = 110;
            var bestDeal       = await _offerController.GetBestDealAsync(request);


            var actualResult = ((BestOfferResponse)((ObjectResult)bestDeal).Value).BestPrice;

            Assert.AreEqual(actualResult, expectedResult);
        }