Exemplo n.º 1
0
 public IActionResult UpdateBorrowRecord(int userId, int tapeId, [FromBody] BorrowRecordInputModel BorrowRecord)
 {
     // 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("User input model improperly formatted.", errorList);
     }
     _tapeService.UpdateBorrowRecord(tapeId, userId, BorrowRecord);
     return(NoContent());
 }
Exemplo n.º 2
0
 public void UpdateBorrowRecord_ShouldCallEditBorrowRecordInBorrowRecordRepository()
 {
     _tapeService.UpdateBorrowRecord(1, 1, It.IsAny <BorrowRecordInputModel>());
     _mockBorrowRecordRepository.Verify(mock => mock.EditBorrowRecord(It.IsAny <int>(), It.IsAny <BorrowRecordInputModel>()), Times.Once());
 }