public void UpdateIFSP_Success() { //Act Mock_IFSP(); var updateIfsp = new IFSPDetailModel { IFSPID = 1, ContactID = 1, IFSPTypeID = 1, IFSPMeetingDate = DateTime.Now, IFSPFamilySignedDate = DateTime.Now, MeetingDelayed = true, ReasonForDelayID = 1, Comments = "Update Success test case", AssessmentID = 1, ResponseID = 1, IsActive = true, ModifiedBy = 5, ModifiedOn = DateTime.Now, ForceRollback = true }; var updateIFSPResult = ifspController.UpdateIFSP(updateIfsp); var response = updateIFSPResult as HttpResult <Response <IFSPDetailModel> >; //Assert Assert.IsNotNull(response, "Response can't be null"); Assert.IsNotNull(response.Value, "Response value can't be null"); Assert.IsNotNull(response.Value.DataItems, "DataItems can't be null"); Assert.IsTrue(response.Value.DataItems.Count > 0, "Response must return data items"); Assert.IsTrue(response.Value.DataItems[0].Comments == "Update Success test case", "IFSP could not be updated."); }
public void UpdateIFSP_Success() { // Arrange PrepareResponse(ifspDataForSuccess); mock.Setup(r => r.UpdateIFSP(It.IsAny <IFSPDetailModel>())) .Callback((IFSPDetailModel ifspModel) => { if (ifspModel.IFSPID > 0) { ifsps.Remove(ifsps.Find(ifsp => ifsp.IFSPID == ifspModel.IFSPID)); ifsps.Add(ifspModel); } }) .Returns(ifspResponse); //Act var updateIfsp = new IFSPDetailModel() { IFSPID = 1, ContactID = 1, IFSPTypeID = 1, IFSPMeetingDate = DateTime.Now, IFSPFamilySignedDate = DateTime.Now, MeetingDelayed = true, ReasonForDelayID = 1, Comments = "Update Success test case", AssessmentID = 1, ResponseID = 1, IsActive = true, ModifiedBy = 5, ModifiedOn = DateTime.Now, ForceRollback = true }; var updateIFSPResult = ifspController.UpdateIFSP(updateIfsp); var response = updateIFSPResult as HttpResult <Response <IFSPDetailModel> >; //Assert Assert.IsNotNull(response, "Response can't be null"); Assert.IsNotNull(response.Value, "Response value can't be null"); Assert.IsNotNull(response.Value.DataItems, "DataItems can't be null"); Assert.IsTrue(response.Value.DataItems.Count > 0, "Response must return data items"); Assert.IsTrue(response.Value.DataItems[0].Comments == "Update Success test case", "IFSP could not be updated."); }
public void UpdateIFSP_Success() { // Act var ifspModel = new IFSPDetailViewModel { IFSPID = 1, ContactID = 1, IFSPTypeID = 1, IFSPMeetingDate = DateTime.Now, IFSPFamilySignedDate = DateTime.Now, MeetingDelayed = true, ReasonForDelayID = 1, Comments = "Success test case", AssessmentID = 1, ResponseID = 1, ForceRollback = true }; var response = controller.UpdateIFSP(ifspModel); // Assert Assert.IsNotNull(response, "Response can not be null"); Assert.IsTrue(response.RowAffected > 0, "IFSP could not be updated."); }