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), "Не удалось удалить направление подготовки"); }
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), "Не удалось удалить направление подготовки"); }
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); }
private void DeleteProfile_Click(object sender, EventArgs e) { string SelectedName = ""; foreach (DataGridViewRow row in dgProfile.SelectedRows) { DataRow Row = ((DataRowView)row.DataBoundItem).Row; SelectedName += (string)Row["FullName"] + ", "; } if (SelectedName.Length > 2) { SelectedName = SelectedName.Remove(SelectedName.Length - 2); } if (SelectedName != "") { DialogResult dr = MessageBox.Show("Удалить профиль - " + SelectedName + "?", "Подтверждение", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dgProfile.SelectedRows.Count > 0 && dr == DialogResult.OK) { int countSelected = dgProfile.SelectedRows.Count; MTrainingProfile Profile; foreach (DataGridViewRow row in dgProfile.SelectedRows) { DataRow Row = ((DataRowView)row.DataBoundItem).Row; Profile = new MTrainingProfile((string)Row["FullName"], (string)Row["ShortName"], (string)Row["Shiphr"]); Program.refData.CTrainingProfile.Delete(Profile); } } } }
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); }
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); }
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 bt_Cr_n_Cl_Click(object sender, EventArgs e)// создать и очистить { if (tbShortName.Text.Length > tbFullName.Text.Length) { MessageBox.Show("Длина поля 'Краткое название профиля' должно быть меньше длины поля 'Полное название профиля'"); return; } if (String.IsNullOrWhiteSpace(tbFullName.Text) || String.IsNullOrWhiteSpace(tbShortName.Text) || String.IsNullOrWhiteSpace(tbCodeSpec.Text)) { MessageBox.Show("Заполните все поля корректно"); } else { MTrainingProfile Profile = new MTrainingProfile(tbFullName.Text, tbShortName.Text, tbCodeSpec.Text); try { if (!Program.refData.CTrainingProfile.Insert(Profile)) { MessageBox.Show("Невозможно добавить профиль подготовки"); return; } tbFullName.Text = ""; tbShortName.Text = ""; tbCodeSpec.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public void DCTrainingProfile_1() { MTrainingProfile mTrainingProfile = new MTrainingProfile("Информационные системы", "ИС", "09.03.02"); int C1 = refData.CTrainingProfile.Rows.Count; Assert.IsTrue(C1 > 0, "Таблица должна быть не пустой"); Assert.IsTrue(refData.CTrainingProfile.Delete(mTrainingProfile), "Не удалось удалить существующую запись"); int C2 = refData.CTrainingProfile.Rows.Count; Assert.IsTrue(C1 - 1 == C2, "Количество записьей не изменилось"); }
public void Task_427_4() { try { MTrainingProfile mTrainingProfile = new MTrainingProfile("Информациооные системы и технологии", "ИС", "40454"); Assert.AreEqual(typeof(string), mTrainingProfile.Shiphr.GetType(), "Ожидался тип поля String"); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void DCTrainingProfile_2() { refData.CCourseSchedule.Clear(); refData.CAcademicLoad.Clear(); refData.CGroup.Clear(); refData.CTrainingProfile.Clear(); Assert.IsTrue(refData.CTrainingProfile.Rows.Count == 0, "Таблица должна быть пустой"); MTrainingProfile mTrainingProfile = new MTrainingProfile("Информационные системы", "ИС", "09.03.02"); Assert.IsFalse(refData.CTrainingProfile.Delete(mTrainingProfile), "Данные из пустой таблицы удалились, чудо"); Assert.IsTrue(refData.CTrainingProfile.Rows.Count == 0, "Таблица должна быть пустой"); }
public AddProfile(MTrainingProfile mProfile) { InitializeComponent(); tbCodeSpec.ReadOnly = true; Text = "Изменение профиля подготовки"; bt_Cr_n_Cl.Visible = false; bt_Cr_n_Close.Text = "Сохранить"; tbFullName.Text = mProfile.FullName; tbFullName.Enabled = false; tbShortName.Text = mProfile.ShortName; tbCodeSpec.Text = mProfile.Shiphr; itsupdate = true; }
public void Task_422_2() { bool ex = false; bool act; MTrainingProfile T_TrainingProfile = new MTrainingProfile("Институт автоматизированных систем и технологий", "ИАСТ", "01.02.03"); int C1 = refData.CTrainingProfile.Rows.Count; act = refData.CTrainingProfile.Delete(T_TrainingProfile); int C2 = refData.CTrainingProfile.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)); }
private void ChangeProfile_Click(object sender, EventArgs e) { if (dgProfile.SelectedRows.Count == 1) { DataRow Row = ((DataRowView)dgProfile.SelectedRows[0].DataBoundItem).Row; MTrainingProfile Profile = new MTrainingProfile((string)Row["FullName"], (string)Row["ShortName"], (string)Row["Shiphr"]); AddProfile add = new AddProfile(Profile); add.Owner = this; add.Show(); } else { MessageBox.Show("Для изменения выделите только одну строку!"); } }
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); }
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); }