Exemplo n.º 1
0
        public async Task GetBidsByLotAsync_GetBidsByExistingLotId_3BidsReturned()
        {
            var lotId = 2;

            _mockUnitWork.Setup(x => x.Bids.GetAllByLotAsync(lotId)).ReturnsAsync(_bids.Where(x => x.LotId == lotId));
            _mockUnitWork.Setup(x => x.Lots.GetAsync(lotId)).ReturnsAsync(_lots.Find(x => x.LotId == lotId));

            var results = await _service.GetBidsByLotAsync(lotId);

            Assert.That(results, Is.Not.Null);
            Assert.That(results.Count(), Is.EqualTo(3));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> GetBidsByLotAsync(int lotId)
        {
            var bids = await _bidsService.GetBidsByLotAsync(lotId);

            if (!bids.Any())
            {
                return(ResponseMessage(new HttpResponseMessage(HttpStatusCode.NoContent)));
            }
            return(Ok(bids));
        }