Example #1
0
        public void Test_MainForm_ComboBoxTrainer()
        {
            var    userType       = UserType.FitnessUser;
            string userTypeString = "Fitness";
            string category       = "Trainer";
            string username       = "******";
            var    loginForm      = new LoginForm();
            var    mainForm       = new MainForm(userType, username, loginForm);

            mainForm.Show();

            var privateObject = new PrivateObject(mainForm);

            System.Windows.Forms.Button randomizeButton = (System.Windows.Forms.Button)privateObject.GetFieldOrProperty("randomizeButton");

            randomizeButton.PerformClick();

            System.Windows.Forms.ComboBox trainerComboBox = (System.Windows.Forms.ComboBox)privateObject.GetFieldOrProperty("trainerComboBox");

            List <string> realProductListTrainer = (List <string>)privateObject.Invoke("GetDataFromDB", new object[] { userTypeString, category });

            string realText = trainerComboBox.Text;

            CollectionAssert.Contains(realProductListTrainer, realText);
        }
Example #2
0
 private void _timer_Tick(object sender, System.EventArgs e)
 {
     if (_h.WaitOne(0, false))
     {
         _okButton.Width   = 0;
         _okButton.Visible = true;
         _okButton.PerformClick();
     }
 }
Example #3
0
 /// <summary>
 /// Performs the click.
 /// </summary>
 /// <param name="xButton">The x button.</param>
 public static void PerformClick(System.Windows.Forms.Button xButton)
 {
     if (xButton.InvokeRequired)
     {
         PerformClick_Delegate xFun = new PerformClick_Delegate(PerformClick);
         xButton.Invoke(xFun, new object[] { xButton });
         return;
     }
     xButton.PerformClick();
 }
Example #4
0
        public void Test_MainForm_ComboBoxSupliments_OneValue()
        {
            var    userType  = UserType.FitnessUser;
            string username  = "******";
            var    loginForm = new LoginForm();
            var    mainForm  = new MainForm(userType, username, loginForm);

            mainForm.Show();

            var privateObject = new PrivateObject(mainForm);

            System.Windows.Forms.Button randomizeButton = (System.Windows.Forms.Button)privateObject.GetFieldOrProperty("randomizeButton");

            randomizeButton.PerformClick();

            System.Windows.Forms.ComboBox suplimentsComboBox = (System.Windows.Forms.ComboBox)privateObject.GetFieldOrProperty("suplimentsComboBox");

            string realText     = suplimentsComboBox.Text;
            string expectedText = "Magneziu";

            Assert.AreEqual(expectedText, realText);
        }