Dynamic_Games.NonCoopForm.checkParams C# (CSharp) Method

checkParams() public method

public checkParams ( ) : bool
return bool
        public bool checkParams()
        {
            if (NoPTB.Text.Equals(""))
            {
                MessageBox.Show(this, "Please enter the number of the players!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            else if (InvestmentTB.Text.Equals(""))
            {
                MessageBox.Show(this, "Please enter the investment!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            else if (MultiTB.Text.Equals(""))
            {
                MessageBox.Show(this, "Please enter the multiplication factor!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            else if (RuleParamTB.Text.Equals(""))
            {
                MessageBox.Show(this, "Please fill every textbox!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            return true;
        }

Usage Example

        public void InputNonCoopTest()
        {
            //(numericPlayer.Value == 0 || textBoxProduct.Text == "" || richTextBoxMaterials.Text == "")
            NonCoopForm nonCoopTest = new NonCoopForm();

            nonCoopTest.NoPTB.Text = "";
            nonCoopTest.InvestmentTB.Text = "";
            nonCoopTest.MultiTB.Text = "";
            nonCoopTest.RuleParamTB.Text = "";
            nonCoopTest.GraphTypeCB.Text = "";
            Assert.IsFalse(nonCoopTest.checkParams());

            nonCoopTest.NoPTB.Text = "30";
            Assert.IsFalse(nonCoopTest.checkParams());

            nonCoopTest.InvestmentTB.Text = "10";
            Assert.IsFalse(nonCoopTest.checkParams());

            nonCoopTest.MultiTB.Text = "5";
            Assert.IsFalse(nonCoopTest.checkParams());

            nonCoopTest.RuleParamTB.Text = "75";
            Assert.IsFalse(nonCoopTest.checkParams());

            nonCoopTest.GraphTypeCB.Text = "Random Graph";
            Assert.IsTrue(nonCoopTest.checkParams());
        }