public IActionResult EditTape(int id, [FromBody] TapeInputModel Tape) { // Check if input model is valid, output all errors if not if (!ModelState.IsValid) { IEnumerable <string> errorList = ModelState.Values.SelectMany(v => v.Errors).Select(x => x.ErrorMessage); throw new InputFormatException("Video tape input model improperly formatted.", errorList); } // Edit tape if input model was valid _tapeService.EditTape(id, Tape); return(NoContent()); }
public void EditTape_ShouldCallEditTapeFromRepository() { _tapeService.EditTape(_tapeMockListSize, It.IsAny <TapeInputModel>()); _mockTapeRepository.Verify(mock => mock.EditTape(_tapeMockListSize, It.IsAny <TapeInputModel>()), Times.Once()); }