public void TestAddTextBoxInspectors() { Assert.ThrowsException <ArgumentOutOfRangeException>(() => _textBoxInspectorsCollection.AddTextBoxInspectors(0, TestDefinition.DUMP_STRING, TestDefinition.DUMP_INTEGER)); Assert.ThrowsException <ArgumentOutOfRangeException>(() => _textBoxInspectorsCollection.AddTextBoxInspectors(8, TestDefinition.DUMP_STRING, TestDefinition.DUMP_INTEGER)); _textBoxInspectorsCollection.AddTextBoxInspectors(1, "Anna", TestDefinition.DUMP_INTEGER); // flag binary format 001 Assert.AreEqual((( TextBoxIsMailInspector )_textBoxInspectorsCollection.Inspectors[0]).Text, "Anna"); _textBoxInspectorsCollection.AddTextBoxInspectors(5, "Bill", 3); // flag binary format 101 for (int index = 1; index <= 2; index++) { Assert.AreEqual((( TextBoxInspector )_textBoxInspectorsCollection.Inspectors[index]).Text, "Bill"); Assert.AreEqual((( TextBoxInspector )_textBoxInspectorsCollection.Inspectors[index]).MaxTextLength, 3); } _textBoxInspectorsCollection.AddTextBoxInspectors(7, "Chris", 0); // flag binary format 111 for (int index = 3; index <= 5; index++) { Assert.AreEqual((( TextBoxInspector )_textBoxInspectorsCollection.Inspectors[index]).Text, "Chris"); Assert.AreEqual((( TextBoxInspector )_textBoxInspectorsCollection.Inspectors[index]).MaxTextLength, 0); } }
/// <summary> /// Add textbox inspectors to the textbox inspectors collection by textBoxInspectorTypeFlag. /// </summary> public void AddTextBoxInspectors(int textBoxInspectorTypeFlag) { _textBoxInspectorsCollection.AddTextBoxInspectors(textBoxInspectorTypeFlag, this.Text, this.MaxLength); }