Esempio n. 1
0
        public void UCGroup_7()
        {
            MDirectionOfPreparation mDirection = new MDirectionOfPreparation("01.03.04", "Прикладная математика", 4, "ИАСТ");

            Assert.IsTrue(refData.CDirectionOfPreparation.Insert(mDirection), "Не удалось вставить профиль обучения");

            MTrainingProfile mTrainingProfile = new MTrainingProfile("Математическое моделирование в экономике и технике", "ММЭТ", "01.03.04");

            Assert.IsTrue(refData.CTrainingProfile.Insert(mTrainingProfile), "Не удалось вставить профиль обучения");

            mTrainingProfile = new MTrainingProfile("Математические методы в экономике", "ММЭ", "01.03.04");
            Assert.IsTrue(refData.CTrainingProfile.Insert(mTrainingProfile), "Не удалось вставить направление подготовки");
            //arrange
            MGroup gr = new MGroup("17-ММбо-2а", 1, "ММЭТ", 1, 1, 0, 0, "Воскресенье");

            Assert.IsTrue(refData.CGroup.Insert(gr), "Не удалось вставить группу" + gr.Group);
            //act
            gr.Specialty = "Т";
            bool actual = refData.CGroup.Update(gr);

            //assert
            Assert.IsFalse(actual, "Произошло обновление некорректной специальности");

            Assert.IsTrue(refData.CGroup.Delete(gr), "Не удалось удалить группу" + gr.Group);

            Assert.IsTrue(refData.CTrainingProfile.Delete(mTrainingProfile), "Не удалось удалить профиль обучения");
            Assert.IsTrue(refData.CDirectionOfPreparation.Delete(mDirection), "Не удалось удалить направление подготовки");
        }
 private void bt_Cr_n_Cl_Click(object sender, EventArgs e)// создать и очистить
 {
     if (!(Regex.IsMatch(tbCod.Text, @"\d{2}.\d{2}.\d{2}")))
     {
         MessageBox.Show("Ведите Код направления в виде: 2 цифры, любой символ, 2 цифры, любой символ, 2 цифры (запятую опустить)");
         tbCod.Focus();
     }
     if (!result || String.IsNullOrWhiteSpace(tbCod.Text) || String.IsNullOrWhiteSpace(tbName.Text) || String.IsNullOrWhiteSpace(nuPeriod.Text))
     {
         MessageBox.Show("Заполните все поля корректно");
     }
     else
     {
         MDirectionOfPreparation mDirection = new MDirectionOfPreparation(tbCod.Text, tbName.Text, (ushort)nuPeriod.Value);
         try
         {
             if (!Program.refData.CDirectionOfPreparation.Insert(mDirection))
             {
                 MessageBox.Show("Невозможно добавить направление подготовки");
                 return;
             }
             tbCod.Text     = "";
             tbName.Text    = "";
             nuPeriod.Value = 1;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Esempio n. 3
0
        public void ICGroup_10()
        {
            //arrange
            bool expected = true;

            MDirectionOfPreparation dp = new MDirectionOfPreparation("12а12б12", "Нбпр", 1, "ИАСТ");
            bool actual1 = refData.CDirectionOfPreparation.Insert(dp);

            Assert.AreEqual(expected, actual1);
            MTrainingProfile tp      = new MTrainingProfile("Профель", "ПРЕФ", dp.CodeOfDP);
            bool             actual2 = refData.CTrainingProfile.Insert(tp);

            Assert.AreEqual(expected, actual2);
            MTrainingProfile tp1     = new MTrainingProfile("Непрофиль", "НЕПРОФ", dp.CodeOfDP);
            bool             actual3 = refData.CTrainingProfile.Insert(tp1);

            Assert.AreEqual(expected, actual3);

            MGroup gr      = new MGroup("17-ЮФбо-2в", 1, tp.ShortName, 1, 1, 0, 0, "Васкресенье");
            bool   actual4 = refData.CGroup.Insert(gr);

            Assert.AreEqual(expected, actual4);
            //act
            MGroup gr1     = new MGroup("17-ЮФбо-2г", 2, tp1.ShortName, 2, 2, 1, 1, "Суббата");
            bool   actual5 = refData.CGroup.Insert(gr1);

            //assert
            Assert.AreEqual(expected, actual5);
        }
Esempio n. 4
0
        public void Task_251_8()
        {
            //arrange
            bool expected = true;

            MDirectionOfPreparation dp = new MDirectionOfPreparation("12а12ж12", "Нжпр", 1);
            bool actual1 = refData.CDirectionOfPreparation.Insert(dp);

            Assert.AreEqual(expected, actual1);
            MTrainingProfile tp      = new MTrainingProfile("Профдль", "ПРОФД", dp.CodeOfDP);
            bool             actual2 = refData.CTrainingProfile.Insert(tp);

            Assert.AreEqual(expected, actual2);
            MTrainingProfile tp1     = new MTrainingProfile("Непрофтль", "НЕПРОФТ", dp.CodeOfDP);
            bool             actual3 = refData.CTrainingProfile.Insert(tp1);

            Assert.AreEqual(expected, actual3);

            MGroup gr = new MGroup("17-ИДбо-2и", 1, tp.ShortName, 1, 1, 0, 1, "Воскресенье");

            refData.CGroup.Insert(gr);
            //act
            MGroup gr1    = new MGroup("17-ИДбо-2к", 2, tp1.ShortName, 2, 2, 1, 1, "Суббота");
            bool   actual = refData.CGroup.Insert(gr1);

            //assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        public void ICGroup_9()
        {
            //arrange
            bool expected = true;

            MDirectionOfPreparation dp = new MDirectionOfPreparation("12а12з12", "Нзпр", 1, "ИАСТ");
            bool actual1 = refData.CDirectionOfPreparation.Insert(dp);

            Assert.AreEqual(expected, actual1);
            MTrainingProfile tp      = new MTrainingProfile("Профёль", "ПРОФЁ", dp.CodeOfDP);
            bool             actual2 = refData.CTrainingProfile.Insert(tp);

            Assert.AreEqual(expected, actual2);
            MTrainingProfile tp1     = new MTrainingProfile("Непрофмль", "НЕПРОФМ", dp.CodeOfDP);
            bool             actual3 = refData.CTrainingProfile.Insert(tp1);

            Assert.AreEqual(expected, actual3);

            MGroup gr      = new MGroup("17-ИДбо-2л", 1, tp.ShortName, 1, 1, 0, 0, "Воскресенье");
            bool   actual4 = refData.CGroup.Insert(gr);

            Assert.AreEqual(expected, actual4);
            //act
            MGroup gr1    = new MGroup("17-ИДбо-2м", 2, tp1.ShortName, 2, 2, 1, 1, "Воскресенье");
            bool   actual = refData.CGroup.Insert(gr1);

            //assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        public void ICGroup_4()
        {
            //arrange
            bool expected = true;

            MDirectionOfPreparation dp = new MDirectionOfPreparation("12а12г12", "Нгпр", 1, "ИАСТ");
            bool actual1 = refData.CDirectionOfPreparation.Insert(dp);

            Assert.AreEqual(expected, actual1);
            MTrainingProfile tp      = new MTrainingProfile("Профаль", "ПРОФА", dp.CodeOfDP);
            bool             actual2 = refData.CTrainingProfile.Insert(tp);

            Assert.AreEqual(expected, actual2);

            MGroup gr      = new MGroup("17-ИДбо-2а", 1, tp.ShortName, 1, 1, 0, 0, "Воскресенье");
            bool   actual4 = refData.CGroup.Insert(gr);

            Assert.AreEqual(expected, actual4);
            //act
            MGroup gr1    = new MGroup("17-ИДбо-2б", 2, tp.ShortName, 2, 2, 1, 1, "Суббота");
            bool   actual = refData.CGroup.Insert(gr1);

            //assert
            Assert.AreEqual(expected, actual);
        }
        private void btDeleteDirection_Click(object sender, EventArgs e)
        {
            string SelectedName = "";

            foreach (DataGridViewRow row in dgDirectionOfPreparation.SelectedRows)
            {
                DataRow Row = ((DataRowView)row.DataBoundItem).Row;
                SelectedName += (string)Row["NameOfDP"] + ", ";
            }
            if (SelectedName.Length > 2)
            {
                SelectedName = SelectedName.Remove(SelectedName.Length - 2);
            }
            if (SelectedName != "")
            {
                DialogResult dr = MessageBox.Show("Удалить направление - " + SelectedName + "?", "Подтверждение", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dgDirectionOfPreparation.SelectedRows.Count > 0 && dr == DialogResult.OK)
                {
                    int countSelected = dgDirectionOfPreparation.SelectedRows.Count;

                    MDirectionOfPreparation Direction;
                    foreach (DataGridViewRow row in dgDirectionOfPreparation.SelectedRows)
                    {
                        DataRow Row = ((DataRowView)row.DataBoundItem).Row;
                        Direction = new MDirectionOfPreparation((string)Row["CodeOfDP"], (string)Row["NameOfDP"], (ushort)Row["PeriodOfStudy"], (string)Row["InstituteShortName"]);
                        Program.refData.CDirectionOfPreparation.Delete(Direction);
                    }
                }
            }
        }
Esempio n. 8
0
        public void UCGroup_5()
        {
            MDirectionOfPreparation mDirection = new MDirectionOfPreparation("01.03.04", "Прикладная математика", 4, "ИАСТ");

            Assert.IsTrue(refData.CDirectionOfPreparation.Insert(mDirection), "Не удалось вставить профиль обучения");

            MTrainingProfile mTrainingProfile = new MTrainingProfile("Математическое моделирование в экономике и технике", "ММЭТ", "01.03.04");

            Assert.IsTrue(refData.CTrainingProfile.Insert(mTrainingProfile), "Не удалось вставить профиль обучения");

            mTrainingProfile = new MTrainingProfile("Математические методы в экономике", "ММЭ", "01.03.04");
            Assert.IsTrue(refData.CTrainingProfile.Insert(mTrainingProfile), "Не удалось вставить направление подготовки");
            //arrange
            MGroup gr = new MGroup("17-ММбо-2а", 1, "ММЭТ", 1, 1, 0, 0, "Воскресенье");

            Assert.IsTrue(refData.CGroup.Insert(gr), "Не удалось вставить группу" + gr.Group);

            bool expected = true;
            //act
            MGroup gr1 = new MGroup("17-ММЭбо-2б", 2, "ММЭ", 2, 2, 1, 1, "Воскресенье");

            Assert.IsTrue(refData.CGroup.Insert(gr1), "Не удалось вставить группу" + gr1.Group);

            gr1.Students = 1;
            bool actual = refData.CGroup.Update(gr1);

            //assert
            Assert.AreEqual(expected, actual, "Ввод корректных данных с дублирующимися студентами не произошел");

            Assert.IsTrue(refData.CGroup.Delete(gr), "Не удалось удалить группу" + gr.Group);
            Assert.IsTrue(refData.CGroup.Delete(gr1), "Не удалось удалить группу" + gr1.Group);

            Assert.IsTrue(refData.CTrainingProfile.Delete(mTrainingProfile), "Не удалось удалить профиль обучения");
            Assert.IsTrue(refData.CDirectionOfPreparation.Delete(mDirection), "Не удалось удалить направление подготовки");
        }
Esempio n. 9
0
 public void MDirectionOfPreparation_3()
 {
     try
     {
         MDirectionOfPreparation mDirectionOfPreparation = new MDirectionOfPreparation("01.02.03", "", 1, "ИАСТ");
         Assert.AreEqual(typeof(ushort), mDirectionOfPreparation.PeriodOfStudy.GetType(), "Ожидался тип поля ushort");
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Esempio n. 10
0
 public void MDirectionOfPreparation_2()
 {
     try
     {
         MDirectionOfPreparation mDirectionOfPreparation = new MDirectionOfPreparation("01.02.03", "", 1, "ИАСТ");
         Assert.AreEqual(typeof(string), mDirectionOfPreparation.NameOfDP.GetType(), "Ожидался тип поля String");
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Esempio n. 11
0
        public void Pre_condition_Del()
        {
            bool ex = true;
            bool act;
            MDirectionOfPreparation T_DirectionOfPreparation = new MDirectionOfPreparation("01.02.03", "Филология", 20, "ИАСТ");
            int C1 = refData.CDirectionOfPreparation.Rows.Count;

            act = refData.CDirectionOfPreparation.Insert(T_DirectionOfPreparation);
            int C2 = refData.CDirectionOfPreparation.Rows.Count;

            Assert.AreEqual(ex, act);
            Assert.AreEqual(C1 + 1, C2);
        }
Esempio n. 12
0
        public void DCDirectionOfPreparation_2()
        {
            bool ex = false;
            bool act;
            MDirectionOfPreparation T_DirectionOfPreparation = new MDirectionOfPreparation("01.02.03", "Филология", 20, "ИАСТ");
            int C1 = refData.CDirectionOfPreparation.Rows.Count;

            act = refData.CDirectionOfPreparation.Delete(T_DirectionOfPreparation);
            int C2 = refData.CDirectionOfPreparation.Rows.Count;

            Assert.AreEqual(ex, act);
            Assert.AreEqual(C1, C2);
        }
        private void DeleteData()
        {
            MTrainingProfile mTrainingProfile = new MTrainingProfile("Математическое моделирование в экономике и технике", "ММЭТ", "01.03.04");

            Assert.IsTrue(refData.CTrainingProfile.Delete(mTrainingProfile));

            mTrainingProfile = new MTrainingProfile("Математические методы в экономике", "ММЭ", "01.03.04");
            Assert.IsTrue(refData.CTrainingProfile.Insert(mTrainingProfile));

            MDirectionOfPreparation mDirection = new MDirectionOfPreparation("01.03.04", "Прикладная математика", 4);

            Assert.IsTrue(refData.CDirectionOfPreparation.Delete(mDirection));
        }
 public AddDirectionOfPreparation(MDirectionOfPreparation mDirection)
 {
     InitializeComponent();
     Text = "Изменение направления";
     bt_Cr_n_Cl.Visible = false;
     bt_Cr_n_Close.Text = "Сохранить";
     tbCod.Text         = mDirection.CodeOfDP;
     tbCod.Enabled      = false;
     tbName.Text        = mDirection.NameOfDP;
     nuPeriod.Text      = Convert.ToString(mDirection.PeriodOfStudy);
     input     = Convert.ToString(nuPeriod.Value);
     result    = ushort.TryParse(input, out number);
     itsupdate = true;
 }
        public void Task_555_1()
        {
            Pre_condition_Del();
            bool ex = true;
            bool act;
            MDirectionOfPreparation T_DirectionOfPreparation = new MDirectionOfPreparation("01.02.03", "Филология", 20);

            int C1 = refData.CDirectionOfPreparation.Rows.Count;

            act = refData.CDirectionOfPreparation.Delete(T_DirectionOfPreparation);
            int C2 = refData.CDirectionOfPreparation.Rows.Count;

            Assert.AreEqual(ex, act);
            Assert.AreEqual(C1 - 1, C2);
        }
 private void btChangeDirection_Click(object sender, EventArgs e)
 {
     if (dgDirectionOfPreparation.SelectedRows.Count == 1)
     {
         DataRow Row = ((DataRowView)dgDirectionOfPreparation.SelectedRows[0].DataBoundItem).Row;
         MDirectionOfPreparation   Direction = new MDirectionOfPreparation((string)Row["CodeOfDP"], (string)Row["NameOfDP"], (ushort)Row["PeriodOfStudy"], (string)Row["InstituteShortName"]);
         AddDirectionOfPreparation add       = new AddDirectionOfPreparation(Direction);
         add.Owner = this;
         add.Show();
     }
     else
     {
         MessageBox.Show("Для изменения выделите только одну строку!");
     }
 }
Esempio n. 17
0
        public void ICGroup_1()
        {
            //arrange
            bool expected = true;
            //act
            MDirectionOfPreparation dp = new MDirectionOfPreparation("12а12а12", "Напр", 1, "ИАСТ");
            bool actual1 = refData.CDirectionOfPreparation.Insert(dp);

            Assert.AreEqual(expected, actual1);
            MTrainingProfile tp      = new MTrainingProfile("Профиль", "ПРОФ", dp.CodeOfDP);
            bool             actual2 = refData.CTrainingProfile.Insert(tp);

            Assert.AreEqual(expected, actual2);
            MGroup gr     = new MGroup("17-ИСбо-2д", 1, tp.ShortName, 1, 1, 0, 0, "Воскресенье");
            bool   actual = refData.CGroup.Insert(gr);

            //assert
            Assert.AreEqual(expected, actual);
        }
Esempio n. 18
0
        public void UCGroup_2()
        {
            MDirectionOfPreparation mDirection = new MDirectionOfPreparation("01.03.04", "Прикладная математика", 4, "ИАСТ");

            Assert.IsTrue(refData.CDirectionOfPreparation.Insert(mDirection), "Не удалось вставить профиль обучения");

            MTrainingProfile mTrainingProfile = new MTrainingProfile("Математическое моделирование в экономике и технике", "ММЭТ", "01.03.04");

            Assert.IsTrue(refData.CTrainingProfile.Insert(mTrainingProfile), "Не удалось вставить профиль обучения");

            mTrainingProfile = new MTrainingProfile("Математические методы в экономике", "ММЭ", "01.03.04");
            Assert.IsTrue(refData.CTrainingProfile.Insert(mTrainingProfile), "Не удалось вставить направление подготовки");

            //arrange
            refData.CCourseSchedule.Clear();
            refData.CAcademicLoad.Clear();
            refData.CGroup.Clear();
            Assert.IsTrue(refData.CGroup.Rows.Count == 0, "Не удалось очистить таблицу группа");

            MGroup gr = new MGroup("17-ММбо-2а", 1, "ММЭТ", 1, 1, 0, 0, "Воскресенье");

            Assert.IsTrue(refData.CGroup.Insert(gr), "Не удалось вставить группу " + gr.Group);
            //act
            MGroup gr1 = new MGroup("17-ММЭбо-2б", 2, "ММЭ", 2, 2, 1, 1, "Понедельник");

            Assert.IsTrue(refData.CGroup.Insert(gr1), "Не удалось вставить группу " + gr1.Group);

            MGroup gr2 = new MGroup("17-ММЭбо-2в", 2, "ММЭ", 1, 2, 1, 1, "Вторник");

            //act

            bool actual = refData.CGroup.Update(gr2);

            //assert
            Assert.IsFalse(actual, "Удалось изменить несуществующую группу в заполненной таблице");
            Assert.IsTrue(refData.CGroup.Delete(gr), "Не удалось удалить группу" + gr.Group);
            Assert.IsTrue(refData.CGroup.Delete(gr1), "Не удалось удалить группу" + gr1.Group);

            Assert.IsTrue(refData.CTrainingProfile.Delete(mTrainingProfile), "Не удалось удалить профиль обучения");
            Assert.IsTrue(refData.CDirectionOfPreparation.Delete(mDirection), "Не удалось удалить направление подготовки");
        }
        /// <summary>
        /// Начальные условия для метода Delete
        /// </summary>
        public void Pre_condition_Del()
        {
            bool exPrep = true;
            bool actPrep;
            MDirectionOfPreparation T_DirectionOfPreparation = new MDirectionOfPreparation("01.02.03", "ИАСТ", 20);
            int DoP1 = refData.CDirectionOfPreparation.Rows.Count;

            actPrep = refData.CDirectionOfPreparation.Insert(T_DirectionOfPreparation);
            int DoP2 = refData.CDirectionOfPreparation.Rows.Count;

            Assert.AreEqual(exPrep, actPrep);
            Assert.AreEqual(DoP1 + 1, DoP2);

            bool             ex = true;
            bool             act;
            MTrainingProfile T_TrainingProfile = new MTrainingProfile("Институт автоматизированных систем и технологий", "ИАСТ", "01.02.03");
            int C1 = refData.CTrainingProfile.Rows.Count;

            act = refData.CTrainingProfile.Insert(T_TrainingProfile);
            int C2 = refData.CTrainingProfile.Rows.Count;

            Assert.AreEqual(ex, act);
            Assert.AreEqual(C1 + 1, C2);
        }