public void TestIsInRangeOfTextBoxInspectorTypes() { Assert.IsFalse(InputInspectorTypeHelper.IsInRangeOfTextBoxInspectorTypes(0)); Assert.IsFalse(InputInspectorTypeHelper.IsInRangeOfTextBoxInspectorTypes(8)); for (int flag = 1; flag <= 7; flag++) { Assert.IsTrue(InputInspectorTypeHelper.IsInRangeOfTextBoxInspectorTypes(flag)); } }
/// <summary> /// Add textbox inspectors by textBoxInspectorTypeFlag. /// </summary> public void AddTextBoxInspectors(int textBoxInspectorTypeFlag, string text, int maxTextLength) { if (!InputInspectorTypeHelper.IsInRangeOfTextBoxInspectorTypes(textBoxInspectorTypeFlag)) { throw new ArgumentException(ERROR_INVALID_TEXT_BOX_INSPECTOR_TYPE_FLAG); } if (InputInspectorTypeHelper.IsContainingTextBoxIsMailFlag(textBoxInspectorTypeFlag)) { _inspectors.Add(new TextBoxIsMailInspector(text, maxTextLength)); } if (InputInspectorTypeHelper.IsContainingTextBoxIsNotEmptyFlag(textBoxInspectorTypeFlag)) { _inspectors.Add(new TextBoxIsNotEmptyInspector(text, maxTextLength)); } if (InputInspectorTypeHelper.IsContainingTextBoxIsOfFullLengthFlag(textBoxInspectorTypeFlag)) { _inspectors.Add(new TextBoxIsOfFullLengthInspector(text, maxTextLength)); } }