Exemple #1
0
    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);
    }
Exemple #2
0
    public void InstanceReturnsNullForOtherObjectTypes()
    {
        TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass));

        form.OnObjectCreated(new OtherTypeOfObject());
        Assert.IsNull(form.Instance);
    }
Exemple #3
0
    public void InstanceReturnsTypesThatImplementAnInterface()
    {
        TestableGetInstanceForm form        = new TestableGetInstanceForm(typeof(IInterface));
        MyInterface             implementor = new MyInterface();

        form.OnObjectCreated(implementor);
        Assert.AreSame(implementor, form.Instance);
    }
Exemple #4
0
    public void InstanceReturnsDerivedTypes()
    {
        TestableGetInstanceForm form    = new TestableGetInstanceForm(typeof(ConcreteClass));
        DerivedClass            derived = new DerivedClass();

        form.OnObjectCreated(derived);
        Assert.AreSame(derived, form.Instance);
    }
Exemple #5
0
    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);
    }
Exemple #6
0
    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);
    }
Exemple #7
0
    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);
    }
Exemple #8
0
    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);
    }
Exemple #9
0
    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);
    }
Exemple #10
0
    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);
    }
Exemple #11
0
    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);
    }
Exemple #12
0
    public void DisableAssemblyComboBoxForSingleMatch()
    {
        TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(Parent));

        Assert.IsFalse(form.comboBoxAssembly.Enabled);
    }
Exemple #13
0
    public void InstanceReturnsNullForNoObject()
    {
        TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(ConcreteClass));

        Assert.IsNull(form.Instance);
    }
Exemple #14
0
    public void TypeIsCachedInNodeTagProperty()
    {
        TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(Parent));

        Assert.AreEqual(typeof(Son), form.treeTypes.Nodes[0].Nodes[1].Tag as Type);
    }
Exemple #15
0
    public void AbstractTypeTextColoringInTreeView()
    {
        TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(AbstractTestBase));

        Assert.AreEqual(System.Drawing.SystemColors.GrayText, form.treeTypes.Nodes[0].Nodes[0].ForeColor);
    }
Exemple #16
0
    public void TypeTreeIsSortedAscending()
    {
        TestableGetInstanceForm form = new TestableGetInstanceForm(typeof(SortTestBase));

        Assert.AreEqual("A", form.treeTypes.Nodes[0].Nodes[0].Text);
    }