public void add_record_test() { file_mngr = new file_contr(); file_mngr.add_from_file(); var student = table_student.instanse(); const int n = 10; string[] arg = new string[n] { "0", "Фамилия", "Имя", "Отчество", "1", "Форма обучения", "Дата рождения", "Адрес", "Телефон", "E-mail" }; student.add_record(arg); var record = student[student.size() - 1]; string[] out_arg = record.get_values(); for (int i = 1; i < n; ++i) { if (arg[i] == "1") { continue; // record.get_values(); возврашает название группы, а не ее код } Assert.AreEqual(arg[i], out_arg[i]); } }
public void clear_record_test() { file_mngr = new file_contr(); file_mngr.add_from_file(); var student = table_student.instanse(); student.clear(); var new_size = student.size(); Assert.AreEqual(new_size, 0); }
public void file_read_test() { var student = table_student.instanse(); student.clear(); int size = student.size(); file_mngr = new file_contr(); file_mngr.add_from_file(); int new_size = student.size(); Assert.AreNotEqual(size, new_size); }
public void delete_record_test() { file_mngr = new file_contr(); file_mngr.add_from_file(); var student = table_student.instanse(); var size = student.size(); var record = student[student.size() - 1]; student.delete_record(record); var new_size = student.size(); Assert.AreEqual(new_size + 1, size); }
public void factory_test() { file_mngr = new file_contr(); file_mngr.add_from_file(); var factory = new specialty_factory(); var specialty = table_specialty.instanse(); const int n = 3; string[] arg = new string[n] { "Код специальности", "Наименование специальности", "Стоимость обучения" }; var record = factory.create_fields(arg); string[] out_arg = record.get_values(); for (int i = 0; i < n; ++i) { Assert.AreEqual(arg[i], out_arg[i]); } }