示例#1
0
    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]);
        }
    }
示例#2
0
        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);
        }
示例#3
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);
    }
示例#4
0
    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);
    }
示例#5
0
        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]);
            }
        }