public ActionResult Update(int markId, int sectionId, int id, [FromBody] MarkGeneralDataPointUpdateRequest markGeneralDataPointRequest) { if (!markGeneralDataPointRequest.Validate()) { return(BadRequest()); } try { _service.Update(id, markId, sectionId, markGeneralDataPointRequest); } catch (ArgumentNullException) { return(NotFound()); } return(NoContent()); }
public void Update_ShouldUpdatemarkGeneralDataPoint() { // Arrange int id = _markGeneralDataPoints[0].Id; int markId = _markGeneralDataPoints[0].Mark.Id; int sectionId = _markGeneralDataPoints[0].Section.Id; var newStringValue = "NewUpdate"; var newMarkGeneralDataPointRequest = new MarkGeneralDataPointUpdateRequest { Text = newStringValue, }; // Act _service.Update( id, markId, sectionId, newMarkGeneralDataPointRequest); // Assert _repository.Verify(mock => mock.Update(It.IsAny <MarkGeneralDataPoint>()), Times.Once); var v = _markGeneralDataPoints.SingleOrDefault(v => v.Id == id); Assert.Equal(newStringValue, v.Text); }