public void ConstructorPopulatesTreeWithTypesThatImplementInterface() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(IInterface)); Assert.AreEqual("IInterface", form.treeTypes.Nodes[0].Text); Assert.AreEqual(3, form.treeTypes.Nodes[0].Nodes[0].Nodes.Count); }
public void InstanceReturnsNullForOtherObjectTypes() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); form.OnObjectCreated(new OtherTypeOfObject()); Assert.IsNull(form.Instance); }
public void InstanceReturnsTypesThatImplementAnInterface() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(IInterface)); MyInterface implementor = new MyInterface(); form.OnObjectCreated(implementor); Assert.AreSame(implementor, form.Instance); }
public void InstanceReturnsDerivedTypes() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); DerivedClass derived = new DerivedClass(); form.OnObjectCreated(derived); Assert.AreSame(derived, form.Instance); }
public void InstanceReturnsObjectFromStaticField() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); form.smoketest_control.listBoxFields.SelectedIndex = 0; form.smoketest_control.field_control.buttonRead_Click(null, null); Assert.IsInstanceOf <ConcreteClass>(form.Instance); }
public void InstanceReturnsObjectCreatedViaStaticProperty() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); form.smoketest_control.listBoxProperties.SelectedIndex = 0; form.smoketest_control.property_control.buttonGet_Click(null, null); Assert.IsInstanceOf <ConcreteClass>(form.Instance); }
public void InstanceReturnsObjectCreatedViaStaticMethod() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); form.smoketest_control.listBoxMethods.SelectedIndex = 0; form.smoketest_control.method_control.buttonCall_Click(null, null); Assert.IsInstanceOf <ConcreteClass>(form.Instance); }
public void InstanceReturnsObjectCreatedViaConstructor() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); form.smoketest_control.listBoxConstructors.SelectedIndex = 0; form.smoketest_control.constructor_control.OnCreateClick(null, null); Assert.IsInstanceOf <ConcreteClass>(form.Instance); }
public void ConstructorPopulatesTreeWithTypesDerivedFromBaseType() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(Parent)); Assert.AreEqual("Parent", form.treeTypes.Nodes[0].Text); Assert.AreEqual(2, form.treeTypes.Nodes[0].Nodes.Count); Assert.AreEqual("Son", form.treeTypes.Nodes[0].Nodes[1].Text); Assert.AreEqual("B21", form.treeTypes.Nodes[0].Nodes[1].Nodes[0].Text); }
public void ConstructWithConcreteType() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(String)); Assert.AreEqual(DockStyle.Fill, form.Controls[0].Dock); Assert.AreEqual("String", form.treeTypes.Nodes[0].Text); Assert.AreEqual(typeof(String), form.treeTypes.Nodes[0].Tag as Type); Assert.AreEqual("Get String Instance", form.Text); Assert.IsFalse(form.buttonSelect.Enabled); }
public void SelectButtonCachesHighlightedObjectAsInstance() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(String)); ObjectPool.pool = new ArrayList() { "A", "B", "C" }; GetInstanceForm.PopulateObjectList(form.listBoxObjects, ObjectPool.pool, typeof(String)); form.listBoxObjects.SelectedIndex = 1; form.buttonSelect_Click(null, null); Assert.AreEqual("B", form.Instance); }
public void DisableAssemblyComboBoxForSingleMatch() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(Parent)); Assert.IsFalse(form.comboBoxAssembly.Enabled); }
public void InstanceReturnsNullForNoObject() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass)); Assert.IsNull(form.Instance); }
public void TypeIsCachedInNodeTagProperty() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(Parent)); Assert.AreEqual(typeof(Son), form.treeTypes.Nodes[0].Nodes[1].Tag as Type); }
public void AbstractTypeTextColoringInTreeView() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(AbstractTestBase)); Assert.AreEqual(System.Drawing.SystemColors.GrayText, form.treeTypes.Nodes[0].Nodes[0].ForeColor); }
public void TypeTreeIsSortedAscending() { TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(SortTestBase)); Assert.AreEqual("A", form.treeTypes.Nodes[0].Nodes[0].Text); }