public void When_GetAllAuctions_Then_Returns_All_TheAuctions() { //Arrange IList <Auction> listOfAuctions = new List <Auction>(); listOfAuctions.Add(new Auction()); listOfAuctions.Add(new Auction()); listOfAuctions.Add(new Auction()); mockRepository.Setup(x => x.GetAll()).Returns(listOfAuctions); //Act And Assert Assert.That(auctionService.GetAll().Count() == 3); }
public Task <HttpResponseMessage> GetAllAuctions() { HttpResponseMessage response; try { var result = auctionBusinessService.GetAll(); response = Request.CreateResponse(HttpStatusCode.OK, result); } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message); } var taskCompletion = new TaskCompletionSource <HttpResponseMessage>(); taskCompletion.SetResult(response); return(taskCompletion.Task); }