public async Task CreateAuctionReturns200IfSuccessful() { var auction = new CreateAuctionDto { StartingPrice = 15.0m, Description = "Guitar" }; var postResponse = await ApiCalls.PostCreateAuction(_client, auction); Assert.Equal(HttpStatusCode.OK, postResponse.StatusCode); }
public async Task Create(CreateAuctionDto input) { Domain.Seller.Seller seller = await GetCurrentSeller(); await _auctionManager.CreateAuction( input.ProductId, input.InitPrice, input.MinAcceptPrice, input.StartDate, input.EndDate, seller.Id ); }
public ActionResult Create([FromBody] CreateAuctionDto dto) { if (!ModelState.IsValid) { return(BadRequest()); } var aggregateId = Guid.NewGuid(); var auction = AuctionDetails.Create(DateTime.UtcNow.AddMinutes(1), dto.StartingPrice, dto.Description); var createAuction = CreateAuction.Create(auction); var command = Command.Create(aggregateId, createAuction); var result = _commandHandler.HandleCommand(command); switch (result) { case CommandResultSuccess _: return(Ok()); default: return(Conflict()); } }
public static async Task <HttpResponseMessage> PostCreateAuction(HttpClient client, CreateAuctionDto dto) { var content = new StringContent(JsonConvert.SerializeObject(dto), Encoding.UTF8, "application/json"); return(await client.PostAsync("/api/auction", content)); }