Пример #1
0
        public void DelAlerts_AllParams_OK()
        {
            bool resExpected = true;
            bool resCalculated;

            resCalculated = Alerts.DelAlert(alertToAdd.Name);

            Assert.AreEqual(resExpected, resCalculated);
        }
        private void btnDelAlert_Click(object sender, EventArgs e)
        {
            //initializing variables to stock informations from the alert
            string         alert      = "";
            string         message    = "";
            List <Bottles> lstBottles = new List <Bottles>();

            // initializing the boolean to check if everything is correct -> all is false by default, so that if it works, it changes to true
            bool successAlert = false;
            bool successDel   = false;

            /**
             * verification of data type
             * if a field is empty and shouldn't be -> the bottle won't be added
             */
            if (comboAlertOUT.SelectedIndex != -1)
            {
                successAlert = true;
            }

            // all checks passed
            if (successAlert)
            {
                successDel = Alerts.DelAlert(comboAlertOUT.SelectedItem.ToString());

                // message box to show, depending on the result when adding the alert
                if (successDel)
                {
                    MessageBox.Show("L'alerte a été correctement supprimée.");
                }
                else
                {
                    MessageBox.Show("Une erreur est survenue lors de l'ajout de l'alerte. Veuillez réessayer.");
                }
            }
            // problems with at least 1 check
            else
            {
                MessageBox.Show("Une des valeurs spécifiées est incorrecte.");
            }
            LoadData();
            grpAddAlert.Hide();
            grpDel.Show();
        }