コード例 #1
0
 /// <summary>
 /// Initialize the input inspectors collection.
 /// </summary>
 private void InitializeInputInspectorsCollection()
 {
     _inputInspectorsCollection = new InputInspectorsCollection();
     foreach (InputInspectingTextBox textBox in _textBoxes)
     {
         _inputInspectorsCollection.AddInputInspectorsList(textBox.GetInputInspectors());
     }
     foreach (InputInspectingDropDownList dropDownList in _dropDownLists)
     {
         _inputInspectorsCollection.AddInputInspectorsList(dropDownList.GetInputInspectors());
     }
 }
        public void TestAddInputInspectorsList()
        {
            Assert.ThrowsException <ArgumentNullException>(() => _inputInspectorsCollection.AddInputInspectorsList(null));
            List <IInputInspector> inspectors = new List <IInputInspector>()
            {
                new TextBoxIsNotEmptyInspector(TestDefinition.DUMP_STRING, TestDefinition.DUMP_INTEGER), new DropDownListIsSelectedInspector(TestDefinition.DUMP_INTEGER)
            };

            _inputInspectorsCollection.AddInputInspectorsList(inspectors);
            List <IInputInspector> expectedInspectors = (List <IInputInspector>)_target.GetFieldOrProperty(MEMBER_VARIABLE_NAME_INSPECTORS);

            Assert.AreSame(expectedInspectors[0], inspectors[0]);
            Assert.AreSame(expectedInspectors[1], inspectors[1]);
            Assert.AreEqual(expectedInspectors.Count, 2);
        }