public void DeleteRowObject_FromOptionObject_RowId_IsNotFound() { RowObject rowObject = new RowObject { RowId = "1||1" }; RowObject rowObject2 = new RowObject { RowId = "2||1" }; FormObject formObject = new FormObject { FormId = "1", MultipleIteration = false }; formObject.CurrentRow = rowObject; OptionObject optionObject = new OptionObject(); optionObject.Forms.Add(formObject); optionObject.DeleteRowObject(rowObject2.RowId); Assert.IsTrue(optionObject.IsRowPresent(rowObject2.RowId)); Assert.IsTrue(optionObject.IsRowMarkedForDeletion(rowObject2.RowId)); }
public void RemoveUneditedRows_OptionObject_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); OptionObject optionObject = new OptionObject() { Forms = new List <FormObject>() { formObject } }; // Act optionObject.SetFieldValue("123", "MODIFIED"); optionObject = (OptionObject)OptionObjectHelpers.RemoveUneditedRows(optionObject); // Assert Assert.IsTrue(optionObject.IsRowPresent("1||1")); }
public void DeleteRowObject_FromOptionObject_MI_RowObject_IsFound() { RowObject rowObject = new RowObject { RowId = "1||1" }; FormObject formObject1 = new FormObject { FormId = "1", MultipleIteration = false }; formObject1.CurrentRow = rowObject; RowObject rowObject1 = new RowObject { RowId = "2||1" }; RowObject rowObject2 = new RowObject { RowId = "2||2" }; FormObject formObject2 = new FormObject { FormId = "1", MultipleIteration = true }; formObject2.CurrentRow = rowObject1; formObject2.OtherRows.Add(rowObject2); OptionObject optionObject = new OptionObject(); optionObject.Forms.Add(formObject1); optionObject.Forms.Add(formObject2); optionObject.DeleteRowObject(rowObject1); optionObject.DeleteRowObject(rowObject2); Assert.IsTrue(optionObject.IsRowPresent(rowObject1.RowId)); Assert.IsTrue(optionObject.IsRowMarkedForDeletion(rowObject1.RowId)); Assert.IsTrue(optionObject.IsRowPresent(rowObject2.RowId)); Assert.IsTrue(optionObject.IsRowMarkedForDeletion(rowObject2.RowId)); }
public void IsRowPresent_OptionObject_FormsNull_Error() { // Arrange string rowId = "1||1"; var optionObject = new OptionObject { Forms = null }; // Act bool actual = optionObject.IsRowPresent(rowId); // Assert Assert.IsTrue(actual); }
public void AddRowObject_ToOptionObject_Success() { string formId = "1"; string expected = "1||1"; RowObject rowObject1 = new RowObject(); FormObject formObject = new FormObject() { FormId = formId, MultipleIteration = false }; OptionObject optionObject = new OptionObject(); optionObject = (OptionObject)OptionObjectHelpers.AddFormObject(optionObject, formObject); optionObject = (OptionObject)OptionObjectHelpers.AddRowObject(optionObject, formId, rowObject1); Assert.IsTrue(optionObject.IsRowPresent(expected)); }
public void IsRowPresent_OptionObject_RowIdEmpty_Error() { // Arrange string rowId = ""; var rowObject = new RowObject(); var formObject = new FormObject() { CurrentRow = rowObject }; var optionObject = new OptionObject(); optionObject.AddFormObject(formObject); // Act bool actual = optionObject.IsRowPresent(rowId); // Assert Assert.IsTrue(actual); }