public void RemoveUneditedRows_OptionObject2015_UnmodifiedFieldIsAbsent() { // Arrange FieldObject fieldObject01 = new FieldObject("123", ""); FieldObject fieldObject02 = new FieldObject("124", ""); FieldObject fieldObject03 = new FieldObject("125", ""); RowObject rowObject01 = new RowObject("1||1", new List <FieldObject>() { fieldObject01, fieldObject02, fieldObject03 }); FormObject formObject = new FormObject("1", rowObject01); OptionObject2015 optionObject = new OptionObject2015() { Forms = new List <FormObject>() { formObject } }; // Act optionObject.SetFieldValue("123", "MODIFIED"); optionObject = (OptionObject2015)OptionObjectHelpers.RemoveUneditedRows(optionObject); // Assert Assert.IsFalse(optionObject.IsFieldPresent("124")); }
public void IsFieldModified_OptionObject2015_IsTrue() { // Arrange FieldObject fieldObject01 = new FieldObject("123", ""); FieldObject fieldObject02 = new FieldObject("124", ""); FieldObject fieldObject03 = new FieldObject("125", ""); RowObject rowObject01 = new RowObject("1||1", new List <FieldObject>() { fieldObject01, fieldObject02, fieldObject03 }); FormObject formObject = new FormObject("1", rowObject01); OptionObject2015 optionObject = new OptionObject2015() { Forms = new List <FormObject>() { formObject } }; // Act optionObject.SetFieldValue("123", "MODIFIED"); // Assert Assert.IsTrue(optionObject.IsFieldModified("123")); }
public OptionObject2015 Execute() { string facility = _optionObject2015.Facility; string userID = _optionObject2015.OptionUserId; string userRole = _repository.GetUserRoleByUserId(facility, userID); //string draftFinalFieldNumber = "295.3"; //string draftFinal = _optionObject2015.GetFieldValue(draftFinalFieldNumber); //string dispositionFieldNumber = "295.14"; //string disposition = _optionObject2015.GetFieldValue(dispositionFieldNumber); string returnMessage = ""; //https://jira.r.local/browse/SCRIPTLINK-70 requires Is this patient enrolled in a program that must meet 42 CFR Part 2 Regulations and defaults to 'Yes' string is42CFRPart2RegulationsFieldNumber = "36017"; if (_optionObject2015.IsFieldPresent(is42CFRPart2RegulationsFieldNumber)) { _optionObject2015.SetRequiredField(is42CFRPart2RegulationsFieldNumber); _optionObject2015.SetFieldValue(is42CFRPart2RegulationsFieldNumber, "1"); //logger.Debug($"Treatment setting: {treatmentSetting}"); //if (treatmentSetting == "I") //{ // logger.Debug("Setting discharge date to required."); // _optionObject2015.SetRequiredField(expectedDischargeDateFieldNumber); //} //else //{ // _optionObject2015.SetOptionalField(expectedDischargeDateFieldNumber); //} //logger.Debug($"Treatment setting: {treatmentSetting}"); } // default Social Security field to 999-99-9999 at initial contact //string ssn = "6"; //if (_optionObject2015.IsFieldPresent(ssn) && string.IsNullOrEmpty(_optionObject2015.GetFieldValue(ssn)) && setUnknown) //{ // logger.Debug("Setting default Social Security field to 999-99-9999 at initial contact."); // string unknown = "999-99-9999"; // _optionObject2015.SetFieldValue(ssn, unknown); //} //logger.Debug($"facility: {facility} userID: {userID} userRole: {userRole} draftFinal: {draftFinal}"); //if (!string.IsNullOrEmpty(userRole) && !userRole.Contains("FinanceBilling") && draftFinal == "F") //{ // _optionObject2015.ErrorCode = 1; // this makes it a hard stop // returnMessage = "Only users with the Finance Billing role can finalize Event Corrections."; // return _optionObject2015.ToReturnOptionObject(ErrorCode.Error, returnMessage); //} //logger.Debug($"facility: {facility} userID: {userID} userRole: {userRole} draftFinal: {draftFinal} disposition: {disposition}"); //if (!string.IsNullOrEmpty(userRole) && userRole.Contains("FinanceBilling") && draftFinal == "F" && string.IsNullOrEmpty(disposition)) //{ // _optionObject2015.ErrorCode = 1; // this makes it a hard stop // returnMessage = "Disposition needs to be selected before finalizing."; // return _optionObject2015.ToReturnOptionObject(ErrorCode.Error, returnMessage); //} return(_optionObject2015.ToReturnOptionObject()); }
public static OptionObject2015 RunScript(OptionObject2015 optionObject, string parameter) { if (optionObject.IsFieldPresent("123")) { string fieldValue = optionObject.GetFieldValue("123"); if (string.IsNullOrEmpty(fieldValue)) { fieldValue = "I have set the FieldValue."; } else { fieldValue += " (I have appended the FieldValue.)"; } optionObject.SetFieldValue("123", fieldValue); } return(optionObject.ToReturnOptionObject(ErrorCode.Success, "If FieldNumber 123 is found in OptionObject, then it should be the only FieldObject returned. Otherwise, no Forms should be returned.")); }
public void Clone_OptionObject2015_AreNotEqual() { List <FieldObject> fieldObjects = new List <FieldObject> { new FieldObject("123", "Test") }; RowObject rowObject = new RowObject("1||1", fieldObjects); FormObject formObject = new FormObject("1", rowObject); OptionObject2015 optionObject = new OptionObject2015("USER00", "userId", "000111", "1", "123456", 1, "UAT", "AVPM", "AVPM", "SERVER", "TOKEN"); optionObject.AddFormObject(formObject); OptionObject2015 cloneOptionObject = (OptionObject2015)ScriptLinkHelpers.Clone(optionObject); optionObject.SetFieldValue("123", "Modified"); Assert.AreNotEqual(optionObject, cloneOptionObject); Assert.IsTrue(optionObject.IsFieldPresent("123")); Assert.IsTrue(cloneOptionObject.IsFieldPresent("123")); }
public void GetReturnOptionObject_ReturnsEditedRow() { OptionObject2015 expected = new OptionObject2015("CWSPN22003", "unittestuser", "", "1", "", 0, "UAT", "AVCWS", "AVCWS", "SERVER", "TOKEN"); FieldObject fieldObject1 = new FieldObject("51003", ""); FieldObject fieldObject2 = new FieldObject("7051.4", ""); FieldObject fieldObject3 = new FieldObject("7051.2", ""); FieldObject fieldObject4 = new FieldObject("7051.3", ""); RowObject rowObject = new RowObject("22003||1"); rowObject.AddFieldObject(fieldObject1); rowObject.AddFieldObject(fieldObject2); rowObject.AddFieldObject(fieldObject3); rowObject.AddFieldObject(fieldObject4); FormObject indForm = new FormObject("22003", rowObject, false); expected.AddFormObject(indForm); expected.SetFieldValue("51003", "Modified"); OptionObject2015 actual = expected.ToReturnOptionObject(); Assert.IsTrue(actual.IsFieldPresent("51003")); }