public void PopulateArgumentRowForAnyType()
    {
        MockMethodControl control = new MockMethodControl();

        control.PopulateNextArgumentRow(typeof(int), "foo");
        Assert.AreSame(typeof(NullCheckBox), control.arguments_control.tableLayoutPanel.Controls[0].GetType());
        NullCheckBox box = control.arguments_control.tableLayoutPanel.Controls[0] as NullCheckBox;
    }
Example #2
0
    public void CheckBoxOffDisablesTargetControls()
    {
        Label        input_control = new Label();
        Button       type_button   = new Button();
        NullCheckBox box           = new NullCheckBox(input_control, type_button, true);

        box.Checked = false;
        box.OnClicked(null, null);
        Assert.IsFalse(input_control.Enabled);
        Assert.IsFalse(type_button.Enabled);
    }
Example #3
0
    public void CheckBoxOnEnablesInputControlForEditableTypes()
    {
        Label        input_control = new Label();
        Button       type_button   = new Button();
        NullCheckBox box           = new NullCheckBox(input_control, type_button, true);

        box.Checked       = true;
        input_control.Tag = null;
        type_button.Tag   = typeof(Int32);
        box.OnClicked(null, null);
        Assert.IsTrue(input_control.Enabled);
    }
Example #4
0
    public void CheckBoxOnDisablesInputControlIfNoInstanceAvailable()
    {
        Label        input_control = new Label();
        Button       type_button   = new Button();
        NullCheckBox box           = new NullCheckBox(input_control, type_button, true);

        box.Checked       = true;
        input_control.Tag = null;
        type_button.Tag   = typeof(AnySupportedArgumentType);
        box.OnClicked(null, null);
        Assert.IsFalse(input_control.Enabled);
    }
Example #5
0
    public void Construction()
    {
        Label        target        = new Label();
        Button       button        = new Button();
        NullCheckBox boxNotChecked = new NullCheckBox(target, button, false);

        Assert.IsFalse(boxNotChecked.Enabled);
        Assert.IsFalse(boxNotChecked.Checked);
        NullCheckBox boxChecked = new NullCheckBox(target, button, true);

        Assert.IsTrue(boxChecked.Enabled);
        Assert.IsTrue(boxChecked.Checked);
    }
    public void PopulateArgumentRowForEnum()
    {
        MockMethodControl control = new MockMethodControl();

        control.PopulateNextArgumentRow(typeof(EnumType), "enum_arg");
        NullCheckBox nullBox = control.arguments_control.tableLayoutPanel.Controls[0] as NullCheckBox;

        Assert.IsFalse(nullBox.Enabled);
        Assert.IsTrue(nullBox.Checked);
        Control input = control.arguments_control.tableLayoutPanel.Controls[ArgumentsControl.Control.Index.INPUT];

        Assert.IsTrue(input.Enabled);
    }
Example #7
0
    public void CheckBoxOnEnablesTypeButtonBasedOnType()
    {
        Label        input_control = new Label();
        Button       type_button   = new Button();
        NullCheckBox box           = new NullCheckBox(input_control, type_button, true);

        box.Checked     = true;
        type_button.Tag = typeof(AnySupportedArgumentType);
        box.OnClicked(null, null);
        Assert.IsTrue(type_button.Enabled);
        type_button.Tag = typeof(AnyNonSupportedArgumentType <int>);
        box.OnClicked(null, null);
        Assert.IsFalse(type_button.Enabled);
    }
    public void PopulateArgumentRowForSingle()
    {
        MockMethodControl control = new MockMethodControl();

        control.PopulateNextArgumentRow(typeof(Single), "single_arg");
        NullCheckBox nullBox = control.arguments_control.tableLayoutPanel.Controls[0] as NullCheckBox;

        Assert.IsFalse(nullBox.Enabled);
        Assert.IsTrue(nullBox.Checked);
        Control input = control.arguments_control.tableLayoutPanel.Controls[ArgumentsControl.Control.Index.INPUT];

        Assert.IsTrue(input.Enabled);
        Assert.AreEqual("0", input.Text);
    }
    public void PopulateArgumentRowForChar()
    {
        MockMethodControl control = new MockMethodControl();

        control.PopulateNextArgumentRow(typeof(char), "char_arg");
        NullCheckBox nullBox = control.arguments_control.tableLayoutPanel.Controls[0] as NullCheckBox;

        Assert.IsFalse(nullBox.Enabled);
        Assert.IsTrue(nullBox.Checked);
        TextBox input = control.arguments_control.tableLayoutPanel.Controls[ArgumentsControl.Control.Index.INPUT] as TextBox;

        Assert.IsTrue(input.Enabled);
        Assert.AreEqual(1, input.MaxLength);
    }