public async Task <IActionResult> Put([FromRoute] int id, [FromBody] BookingSectorDTO bookingSectorDTO) { var bookingTournament = await bookingSectorService.UpdateBookingTournament(id, bookingSectorDTO); if (bookingTournament != null) { return(Ok(bookingTournament)); } else { return(NotFound()); } }
public async Task UpdateTournamentBooking_InputIsBookingSectorData_ReturnsUpdatedBookingSectorDTO(int id) { //Arrange bookingSectorRepositoryMock.Setup(b => b.UpdateEntity(It.IsAny <BookingSector>())) .Returns((BookingSector booking) => { bookingsSectorContext[bookingsSectorContext.FindIndex(b => b.Id == booking.Id)] = booking; return(booking); }); //Act var result = await bookingSectorService.UpdateBookingTournament(id, bookingSectorDTO); //Assert Assert.IsNotNull(result); Assert.IsInstanceOf <BookingSectorDTO>(result); Assert.AreEqual(bookingsSectorContext[id - 1].Id, result.Id); }