public void TestDaoSessionExamsCRUD()
        {
            DaoSessionExams daoExams = new DaoSessionExams(connectionString);

            var allExams = daoExams.GetAllRecords();
            int count    = allExams.Count;

            SessionExam exam = new SessionExam(2, 8, "exam", 1, new DateTime(2020, 12, 21));

            daoExams.Create(exam);

            allExams = daoExams.GetAllRecords();
            Assert.AreEqual(count + 1, allExams.Count);

            exam.ID = allExams.Last().ID;

            exam.GroupID   = 3;
            exam.SubjectID = 3;

            daoExams.Update(exam);

            SessionExam updExam = daoExams.GetById(exam.ID);

            Assert.AreEqual(exam, updExam);

            daoExams.Delete(exam);
            Assert.AreEqual(count, daoExams.GetAllRecords().Count);
        }
        public void TestEntitiesEquals()
        {
            Student std1 = new Student(2, "Igor", "Yeliseev", "Andreevich", 1, "male", new DateTime(1999, 5, 22));
            Student std2 = new Student(2, "Igor", "Yeliseev", "Andreevich", 1, "male", new DateTime(1999, 5, 22));

            Assert.AreEqual(std1, std2);

            Subject sbj1 = new Subject(2, "Geography");
            Subject sbj2 = new Subject(2, "Geography");

            Assert.AreEqual(sbj1, sbj2);

            Group group1 = new Group(1, "IS-21");
            Group group2 = new Group(1, "IS-21");

            Assert.AreEqual(group1, group2);

            SessionExam exam1 = new SessionExam(21, 1, 2, "exam", 2, new DateTime(2020, 1, 12));
            SessionExam exam2 = new SessionExam(21, 1, 2, "exam", 2, new DateTime(2020, 1, 12));

            Assert.AreEqual(exam1, exam2);

            SessionResult result1 = new SessionResult(1, 1, 3, 8);
            SessionResult result2 = new SessionResult(1, 1, 3, 8);

            Assert.AreEqual(result1, result2);
        }
Beispiel #3
0
        public void TestEntitiesEquals()
        {
            Examinator examinator1 = new Examinator(1, "Петр Петрович Иванов");
            Examinator examinator2 = new Examinator(1, "Петр Петрович Иванов");

            Assert.AreEqual(examinator1, examinator2);

            Specialty specialty1 = new Specialty(2, "Экономист");
            Specialty specialty2 = new Specialty(2, "Экономист");

            Assert.AreEqual(specialty1, specialty2);

            Student std1 = new Student(2, "Igor", "Yeliseev", "Andreevich", 1, "male", new DateTime(1999, 5, 22));
            Student std2 = new Student(2, "Igor", "Yeliseev", "Andreevich", 1, "male", new DateTime(1999, 5, 22));

            Assert.AreEqual(std1, std2);

            Subject sbj1 = new Subject(2, "Geography");
            Subject sbj2 = new Subject(2, "Geography");

            Assert.AreEqual(sbj1, sbj2);

            Group group1 = new Group(1, "IS-21", 1);
            Group group2 = new Group(1, "IS-21", 1);

            Assert.AreEqual(group1, group2);

            SessionExam exam1 = new SessionExam(21, 1, 2, "exam", 2, new DateTime(2020, 1, 12));
            SessionExam exam2 = new SessionExam(21, 1, 2, "exam", 2, new DateTime(2020, 1, 12));

            Assert.AreEqual(exam1, exam2);

            SessionResult result1 = new SessionResult(1, 1, 3, 8);
            SessionResult result2 = new SessionResult(1, 1, 3, 8);

            Assert.AreEqual(result1, result2);
        }