public void AddIFSP_Success() { //Act Mock_IFSP(); var addIFSP = new IFSPDetailModel { IFSPID = 2, ContactID = 1, IFSPTypeID = 1, IFSPMeetingDate = DateTime.Now, IFSPFamilySignedDate = DateTime.Now, MeetingDelayed = true, ReasonForDelayID = 1, Comments = "Success test case", AssessmentID = 1, ResponseID = 1, IsActive = true, ModifiedBy = 5, ModifiedOn = DateTime.Now, ForceRollback = true }; var addIFSPResult = ifspController.AddIFSP(addIFSP); var response = addIFSPResult 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, "Response value can't be null"); Assert.IsTrue(response.Value.DataItems.Count == 2, "IFSP could not be created."); }
public void AddIFSP_Success() { // Arrange //PrepareResponse(ifspDataForSuccess); ifsps = new List <IFSPDetailModel>(); ifspResponse = new Response <IFSPDetailModel>() { DataItems = ifsps }; mock.Setup(r => r.AddIFSP(It.IsAny <IFSPDetailModel>())) .Callback((IFSPDetailModel ifspModel) => { if (ifspModel.IFSPID > 0) { ifsps.Add(ifspModel); } }) .Returns(ifspResponse); //Act var addIFSP = new IFSPDetailModel() { IFSPID = 2, ContactID = 1, IFSPTypeID = 1, IFSPMeetingDate = DateTime.Now, IFSPFamilySignedDate = DateTime.Now, MeetingDelayed = true, ReasonForDelayID = 1, Comments = "Add Success test case", AssessmentID = 1, ResponseID = 1, IsActive = true, ModifiedBy = 5, ModifiedOn = DateTime.Now, ForceRollback = true }; var addIFSPResult = ifspController.AddIFSP(addIFSP); var response = addIFSPResult 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, "Response value can't be null"); Assert.IsTrue(response.Value.DataItems.Count == 1, "IFSP could not be created."); }
public void AddIFSP_Success() { // Act var ifspModel = new IFSPDetailViewModel { IFSPID = 0, 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.AddIFSP(ifspModel); // Assert Assert.IsNotNull(response, "Response can not be null"); Assert.IsTrue(response.RowAffected > 0, "IFSP could not be created."); }