예제 #1
0
        public void TestMethod_InputMoreBachelorStudents()
        {
            Faculty testFax = new Faculty("ETF");

            /* Container class "Faculty" has default
             * start bachelor index value at 17000.
             * Two of the additional students added
             * to the list should have indices
             * "17001" and "17002".
             */
            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            string index = testFax.ListOfBachelorStudents[0].IndexIDNumber;

            Assert.AreEqual(index, "17000");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111112", new DateTime(2005, 1, 1));
            index = testFax.ListOfBachelorStudents[1].IndexIDNumber;
            Assert.AreEqual(index, "17001");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111113", new DateTime(2005, 1, 1));
            index = testFax.ListOfBachelorStudents[2].IndexIDNumber;
            Assert.AreEqual(index, "17002");

            CollectionAssert.AllItemsAreUnique(testFax.ListOfBachelorStudents);
            CollectionAssert.AllItemsAreUnique(testFax.ListOfAllStudent);
            CollectionAssert.AllItemsAreNotNull(testFax.ListOfBachelorStudents);
            CollectionAssert.IsSubsetOf(testFax.ListOfBachelorStudents, testFax.ListOfAllStudent);
        }
예제 #2
0
        public void TestMethod_bachelor_GetterInfoValidity()
        {
            Faculty testFax = new Faculty("ETF");

            /* We are sending instance of bachelor student
             * without index number because container
             * class "Faculty" is generating index for us.
             */
            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            string index = testFax.ListOfBachelorStudents[0].IndexIDNumber;

            Assert.AreEqual(index, "17000");
            string name = testFax.ListOfBachelorStudents[0].Name;

            Assert.AreEqual(name, "name");
            string surname = testFax.ListOfBachelorStudents[0].Surname;

            Assert.AreEqual(surname, "surname");
            DateTime birth = testFax.ListOfBachelorStudents[0].DateOfBirth;

            Assert.AreEqual(birth, new DateTime(1990, 1, 1));
            string ID = testFax.ListOfBachelorStudents[0].IDnumber;

            Assert.AreEqual(ID, "1111111111111");
            DateTime endOfPrevEd = testFax.ListOfBachelorStudents[0].EndOfPreviousEducation;

            Assert.AreEqual(endOfPrevEd, new DateTime(2005, 1, 1));

            /* Adding passed courses for the student */
            List <Course> passed = new List <Course>();

            testFax.ListOfBachelorStudents[0].PassedCourses = passed;
            Assert.AreEqual(passed, testFax.ListOfBachelorStudents[0].PassedCourses);
        }
        public void DataDrivenTest_CreatingBachelorFromDatabase()
        {
            bachelorStudent test = new bachelorStudent(Convert.ToString(TestContext.DataRow["Name"]), Convert.ToString(TestContext.DataRow["Surname"]), Convert.ToDateTime(TestContext.DataRow["DateOfBirth"]), Convert.ToString(TestContext.DataRow["IDNumber"]), Convert.ToString(TestContext.DataRow["IDIndexNumber"]), Convert.ToDateTime(TestContext.DataRow["EndOfPrevEd"]));

            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent(Convert.ToString(TestContext.DataRow["Name"]), Convert.ToString(TestContext.DataRow["Surname"]), Convert.ToDateTime(TestContext.DataRow["DateOfBirth"]), Convert.ToString(TestContext.DataRow["IDNumber"]), Convert.ToDateTime(TestContext.DataRow["EndOfPrevEd"]));
            Assert.IsTrue(test.IDnumber == testFax.FindStudent(Convert.ToString(TestContext.DataRow["IDNumber"])));
        }
        public void TestMethod_FindBachelorStudentCSV()
        {
            bachelorStudent test = new bachelorStudent(Convert.ToString(TestContext.DataRow["Name"]), Convert.ToString(TestContext.DataRow["Surname"]), new DateTime(1990, 1, 1), Convert.ToString(TestContext.DataRow["IDNumber"]), Convert.ToString(TestContext.DataRow["IDIndexNumber"]), new DateTime(2013, 1, 5));

            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent(Convert.ToString(TestContext.DataRow["Name"]), Convert.ToString(TestContext.DataRow["Surname"]), new DateTime(1990, 1, 1), Convert.ToString(TestContext.DataRow["IDNumber"]), new DateTime(2013, 1, 5));
            Assert.IsTrue(test.IDnumber == testFax.FindStudent(Convert.ToString(TestContext.DataRow["IDNumber"])));
        }
예제 #5
0
        public void TestMethod_InputBachelorStudent()
        {
            Faculty testFax = new Faculty("ETF");

            /* We are sending instance of bachelor student
             * without index number because container
             * class "Faculty" is generating index for us.
             */
            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
        }
        public void TestMethod_FacultyBalance()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111112", new DateTime(2005, 1, 1));
            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111113", new DateTime(2005, 1, 1));
            double expenditures = testFax.Balance;

            Assert.AreEqual(expenditures, 9000 * 3);

            testFax.AddMasterStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111114", new DateTime(2005, 1, 1), "ETF Sarajevo");
            testFax.AddMasterStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111115", new DateTime(2005, 1, 1), "ETF Sarajevo");
            testFax.AddMasterStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111116", new DateTime(2005, 1, 1), "ETF Sarajevo");
            expenditures = testFax.Balance;
            Assert.AreEqual(expenditures, (9000 * 3) + (11000 * 3));

            Assert.AreEqual(testFax.FLAG, 1);
        }
예제 #7
0
        public void TestMethod_DeletingBachelorStudent_ByID()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            Assert.AreEqual(testFax.ListOfAllStudent.Count, 1);
            Assert.AreEqual(testFax.ListOfBachelorStudents.Count, 1);

            testFax.deleteStudentByID("1111111111111");
            Assert.AreEqual(testFax.ListOfAllStudent.Count, 0);
            Assert.AreEqual(testFax.ListOfBachelorStudents.Count, 0);
        }
예제 #8
0
        public void TestMethod_InputMoreBachelorStudents_SameID()
        {
            Faculty testFax = new Faculty("ETF");

            /* We are sending instance of bachelor student
             * without index number because container
             * class "Faculty" is generating index for us.
             */
            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            string index = testFax.ListOfBachelorStudents[0].IndexIDNumber;

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            index = testFax.ListOfBachelorStudents[1].IndexIDNumber;

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            index = testFax.ListOfBachelorStudents[2].IndexIDNumber;

            /* Exception should be thrown
             * because all instances of students
             * have the same ID.
             */
        }
예제 #9
0
        public void TestMethod_bachelor_GeneratedIndexValidity()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            string index = testFax.ListOfBachelorStudents[0].IndexIDNumber;

            /* Container class "Faculty" has default
             * start bachelor index value at 17000
             */
            Assert.AreEqual(index, "17000");
            StringAssert.Matches(index, INDEX_ID_NUMBER_PATTERN);
        }
예제 #10
0
        public void TestMethod_bachelor_SetterInfoValidity()
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));

            string index = testFax.ListOfBachelorStudents[0].IndexIDNumber;

            Assert.AreEqual(index, "17000");

            testFax.ListOfBachelorStudents[0].Name = "changedName";
            string name = testFax.ListOfBachelorStudents[0].Name;

            Assert.AreEqual(name, "changedName");

            testFax.ListOfBachelorStudents[0].Surname = "changedSurname";
            string surname = testFax.ListOfBachelorStudents[0].Surname;

            Assert.AreEqual(surname, "changedSurname");

            testFax.ListOfBachelorStudents[0].DateOfBirth = new DateTime(1994, 1, 1);
            DateTime birth = testFax.ListOfBachelorStudents[0].DateOfBirth;

            Assert.AreEqual(birth, new DateTime(1994, 1, 1));

            testFax.ListOfBachelorStudents[0].IDnumber = "2222222222222";
            string ID = testFax.ListOfBachelorStudents[0].IDnumber;

            Assert.AreEqual(ID, "2222222222222");

            testFax.ListOfBachelorStudents[0].EndOfPreviousEducation = new DateTime(2006, 1, 1);
            DateTime endOfPrevEd = testFax.ListOfBachelorStudents[0].EndOfPreviousEducation;

            Assert.AreEqual(endOfPrevEd, new DateTime(2006, 1, 1));

            /* Setting new list of passed courses for the student */
            List <Course> passed = new List <Course>();

            testFax.ListOfBachelorStudents[0].PassedCourses = passed;
            List <Course> passedChanged = new List <Course>();

            testFax.ListOfBachelorStudents[0].PassedCourses = passedChanged;
            Assert.AreEqual(passedChanged, testFax.ListOfBachelorStudents[0].PassedCourses);
        }
        public void TestMethod_InputMasterStudent_ifBachelorStudentExists()
        {
            Faculty testFax = new Faculty("ETF");

            /* We are adding bachelor student */
            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1));
            /* List of all bachelor students and all students should be 1. */
            Assert.AreEqual(testFax.ListOfBachelorStudents.Count, 1);
            Assert.AreEqual(testFax.ListOfAllStudent.Count, 1);
            /* Index number of entered student should be 17000 */
            Assert.AreEqual(testFax.ListOfBachelorStudents[0].IndexIDNumber, "17000");

            /* We are adding master student with same person ID! */
            testFax.AddMasterStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2005, 1, 1), "ETF Sarajevo");
            /* Now, there should be 0 bachelor students and 1 master student in container class */
            Assert.AreEqual(testFax.ListOfBachelorStudents.Count, 0);
            Assert.AreEqual(testFax.ListOfMasterStudents.Count, 1);
            /* Master student index should be his last index (17000) with added 100 as generated by the container class */
            Assert.AreEqual(testFax.ListOfMasterStudents[0].IndexIDNumber, "100/17000");
            /* List of all students should remain at 1 */
            Assert.AreEqual(testFax.ListOfAllStudent.Count, 1);
        }
예제 #12
0
        public void TestMethod_bStudent_invalidDateOfPreviousEd() // Invalid date of previous education
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2020, 1, 1));
        }
예제 #13
0
        public void TestMethod_bStudent_invalidPersonId_numeric() // Invalid person ID - numeric (must be 13 letters)
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surname", new DateTime(1990, 1, 1), "11111111111a#", new DateTime(2016, 1, 1));
        }
예제 #14
0
        public void TestMethod_bStudent_invalidBirthDate() // Invalid birth date
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surname", new DateTime(2017, 1, 1), "1111111111111", new DateTime(2016, 1, 1));
        }
예제 #15
0
        public void TestMethod_bStudent_invalidSurname() // Invalid surname
        {
            Faculty testFax = new Faculty("ETF");

            testFax.AddBachelorStudent("name", "surn@@ame", new DateTime(1990, 1, 1), "1111111111111", new DateTime(2016, 1, 1));
        }