Esempio n. 1
0
        public void AddRecordToListStudentsWhenListIsNullNullRefrenceExceptionThrown()
        {
            // arrange
            Student stud = new Student("John", "Carlson", "23 street", "Dublin", "Ireland",
                                       "0987T", "2345657", "john@gmail", Status.UnderGrad, 33, "Paleontology");

            List <Student> list = null;

            // act
            FormsMethods.AddRecordToList(list, stud);
        }
Esempio n. 2
0
        public void AddRecordToListLecturersWhenListIsNullNullReferenceExceptionThrown()
        {
            // arrange
            Lecturer lect = new Lecturer("John", "Carlson", "23 street", "Dublin", "Ireland",
                                         "0987T", "2345657", "john@gmail", 33, 32435M, "Paleontology");

            List <Lecturer> list = null;

            // act
            FormsMethods.AddRecordToList(list, lect);
        }
Esempio n. 3
0
        public void AddRecordToListStudentPhoneNumberPropertyNotInCorrectFormatFormatExceptionThrown()
        {
            // arrange
            Student stud = new Student("Mark", "Allison", "19 Bervael", "Denver",
                                       "USA", "0567L", "sert", "*****@*****.**", Status.UnderGrad, 23, "Business");
            List <Student> list = new List <Student>()
            {
                new Student("John", "Carlson", "19 Bervael", "Denver",
                            "USA", "0567L", "33309876", "*****@*****.**", Status.PostGrad, 33, "Business")
            };

            // act
            FormsMethods.AddRecordToList(list, stud);
        }
Esempio n. 4
0
        public void AddRecordToListStudentStatusPropertyNotInTheRangeArgOutOfRangeExceptionThrown()
        {
            // arrange
            Student stud = new Student("Mark", "Allison", "19 Bervael", "Denver",
                                       "USA", "0567L", "33309876", "*****@*****.**", (Status)5, 33, "Business");
            List <Student> list = new List <Student>()
            {
                new Student("John", "Carlson", "19 Bervael", "Denver",
                            "USA", "0567L", "33309876", "*****@*****.**", Status.PostGrad, 30, "Business")
            };

            // act
            FormsMethods.AddRecordToList(list, stud);
        }
Esempio n. 5
0
        public void AddRecordToListLecturersPhoneNumberPropertyNotInCorrectFormatFormatExceptionThrown()
        {
            // arrange
            Lecturer lect = new Lecturer("Mark", "Allison", "19 Bervael", "Denver",
                                         "USA", "0567L", "sert", "*****@*****.**", 35, 32435M, "Business");
            List <Lecturer> list = new List <Lecturer>()
            {
                new Lecturer("John", "Carlson", "19 Bervael", "Denver",
                             "USA", "0567L", "33309876", "*****@*****.**", 33, 32453M, "Business")
            };

            // act
            FormsMethods.AddRecordToList(list, lect);
        }
Esempio n. 6
0
        public void AddRecordToListStudentsWhenRecordIsNullNullReferenceExceptionThrown()
        {
            // arrange
            Student        stud = null;
            List <Student> list = new List <Student>()
            {
                new Student("John", "Carlson", "23 street", "Dublin", "Ireland",
                            "0987T", "2345657", "john@gmail", Status.UnderGrad, 33, "Paleontology"),
                new Student("Mat", "Benny", "23 street", "Dublin", "Ireland",
                            "0987T", "2345657", "mat@gmail", Status.PostGrad, 44, "Programming")
            };

            // act
            FormsMethods.AddRecordToList(list, stud);
        }
Esempio n. 7
0
        public void AddRecordToListLecturersWhenRecordIsNullNullReferenceExceptionThrown()
        {
            // arrange
            Lecturer        lect = null;
            List <Lecturer> list = new List <Lecturer>()
            {
                new Lecturer("John", "Carlson", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "john@gmail", 33, 2435M, "Paleontology"),
                new Lecturer("Mat", "Benny", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "mat@gmail", 44, 42536M, "Programming")
            };

            // act
            FormsMethods.AddRecordToList(list, lect);
        }
Esempio n. 8
0
        public void AddRecordToListStudentsPropertyNullArgNullExceptionThrown()
        {
            // arrange
            Student stud = new Student("", "Allison", "23 street", "Dublin", "Ireland",
                                       "0987T", "2345657", "@gmail", Status.PostGrad, 40, "Engineering");
            List <Student> list = new List <Student>()
            {
                new Student("John", "Carlson", "23 street", "Dublin", "Ireland",
                            "0987T", "2345657", "john@gmail", Status.PostGrad, 33, "Gemmology"),
                new Student("Mat", "Benny", "23 street", "Dublin", "Ireland",
                            "0987T", "2345657", "mark@gmail", Status.UnderGrad, 44, "Archeology")
            };

            // act
            FormsMethods.AddRecordToList(list, stud);
        }
Esempio n. 9
0
        public void AddRecordToListStudentsRecordIdAlreadyExistsArgExceptionThrown()
        {
            // arrange
            Student stud = new Student("Mark", "Allison", "23 street", "Dublin", "Ireland",
                                       "0987T", "2345657", "mark@gmail", Status.UnderGrad, 44, "Geology");
            List <Student> list = new List <Student>()
            {
                new Student("John", "Carlson", "23 street", "Dublin", "Ireland",
                            "0987T", "2345657", "john@gmail", Status.UnderGrad, 33, "Geophysics"),
                new Student("Mat", "Benny", "23 street", "Dublin", "Ireland",
                            "0987T", "2345657", "mat@gmail", Status.PostGrad, 44, "Sismology")
            };

            // act
            FormsMethods.AddRecordToList(list, stud);
        }
Esempio n. 10
0
        public void AddRecordToListLecturerPropertyFormatNotCorrectFormatExceptionThrown()
        {
            // arrange
            Lecturer lect = new Lecturer("Mark", "Allison", "23 street", "Dublin", "Ireland",
                                         "0987T", "2345657", "mark@gmail", int.Parse("ser"), 2435M, "Maths");
            List <Lecturer> list = new List <Lecturer>()
            {
                new Lecturer("John", "Carlson", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "john@gmail", 33, 2435M, "Paleontology"),
                new Lecturer("Mat", "Benny", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "mat@gmail", 44, 42536M, "Programming")
            };

            // act
            FormsMethods.AddRecordToList(list, lect);
        }
Esempio n. 11
0
        public void AddRecordToListLecturerPropertyNullArgNullExceptionThrown()
        {
            // arrange
            Lecturer lect = new Lecturer("", "Allison", "23 street", "Dublin", "Ireland",
                                         "0987T", "2345657", "@gmail", 44, 3435M, "Engineering");
            List <Lecturer> list = new List <Lecturer>()
            {
                new Lecturer("John", "Carlson", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "john@gmail", 33, 132454M, "Gemmology"),
                new Lecturer("Mat", "Benny", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "mark@gmail", 44, 32435M, "Archeology")
            };

            // act
            FormsMethods.AddRecordToList(list, lect);
        }
Esempio n. 12
0
        public void AddRecordToListLecturerRecordIdAlreadyExistsArgExceptionThrown()
        {
            // arrange
            Lecturer lect = new Lecturer("Mark", "Allison", "23 street", "Dublin", "Ireland",
                                         "0987T", "2345657", "mark@gmail", 44, 4355M, "Geology");
            List <Lecturer> list = new List <Lecturer>()
            {
                new Lecturer("John", "Carlson", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "john@gmail", 33, 3245M, "Geophysics"),
                new Lecturer("Mat", "Benny", "23 street", "Dublin", "Ireland",
                             "0987T", "2345657", "mat@gmail", 44, 3245M, "Sismology")
            };

            // act
            FormsMethods.AddRecordToList(list, lect);
        }
Esempio n. 13
0
        public void AddRecordToListStudentsVerifyObjectIsReallyAddedToList()
        {
            // arrange
            Student stud = new Student("Mark", "Allison", "19 street", "Dublin", "Ireland",
                                       "0897Y", "23456546", "mark@gmail", Status.UnderGrad, 12, "Chemistry");
            List <Student> anyList = new List <Student>()
            {
                new Student("John", "Carlson", "19 street", "Dublin", "Ireland",
                            "0897Y", "23456546", "john@gmail", Status.UnderGrad, 33, "Biology"),
                new Student("Mat", "Benny", "19 street", "Dublin", "Ireland",
                            "0897Y", "23456546", "mat@gmail", Status.PostGrad, 44, "Arts")
            };


            // act
            FormsMethods.AddRecordToList(anyList, stud);

            // assert
            CollectionAssert.Contains(anyList, stud);
        }
Esempio n. 14
0
        public void AddRecordToListLecturersVerifyObjectIsReallyAddedToList()
        {
            // arrange
            Lecturer lect = new Lecturer("Mark", "Allison", "19 street", "Dublin", "Ireland",
                                         "0897Y", "23456546", "mark@gmail", 12, 23456M, "Chemistry");
            List <Lecturer> anyList = new List <Lecturer>()
            {
                new Lecturer("John", "Carlson", "19 street", "Dublin", "Ireland",
                             "0897Y", "23456546", "john@gmail", 33, 34556M, "Biology"),
                new Lecturer("Mat", "Benny", "19 street", "Dublin", "Ireland",
                             "0897Y", "23456546", "mat@gmail", 44, 2454M, "Arts")
            };


            // act
            FormsMethods.AddRecordToList(anyList, lect);

            // assert
            CollectionAssert.Contains(anyList, lect);
        }