public void TestButtonDel() { LaboratoryStaff Lb = new LaboratoryStaff(); Lb.Show(); DataGridViewRow item = Lb.dataGridView1.Rows[0]; int id = int.Parse(item.Cells["id"].Value.ToString()); Lb.Hide(); EditingData red = new EditingData(id); red.Show(); red.button1.PerformClick(); Lb.Dispose(); Lb = new LaboratoryStaff(); Lb.Show(); foreach (DataGridViewRow item1 in Lb.dataGridView1.Rows) { if (item1.Cells["id"].Value.ToString().Equals(id.ToString())) { Assert.Fail(); } } }
public void TestRedStaff() { LaboratoryStaff Lb = new LaboratoryStaff(); Lb.Show(); DataGridViewRow item = Lb.dataGridView1.Rows[0]; int id = int.Parse(item.Cells["id"].Value.ToString()); Lb.Hide(); EditingData red = new EditingData(id); red.Show(); Assert.AreEqual(red.family.Text, item.Cells["Фамилия"].Value.ToString()); Assert.AreEqual(red.name.Text, item.Cells["Имя"].Value.ToString()); Assert.AreEqual(red.surname.Text, item.Cells["Отчество"].Value.ToString()); Assert.AreEqual(red.position.Text, item.Cells["Должность"].Value.ToString()); red.family.Text = "Петров"; red.name.Text = "Игорь"; red.buttonSave.PerformClick(); Lb.Dispose(); Lb = new LaboratoryStaff(); Lb.Show(); foreach (DataGridViewRow item1 in Lb.dataGridView1.Rows) { if (item1.Cells["Фамилия"].Value.ToString().Equals("Петров")) { return; } } Assert.Fail(); }