Beispiel #1
0
        public void FilterListLecturersIfInpuListIsNullNullReferenceExceptionThrow()
        {
            // arrange
            string          input     = "Sen";
            List <Lecturer> inputList = null;

            // act
            FormsMethods.FilterList(inputList, input);
        }
Beispiel #2
0
        public void FilterListStudentsIfInpuListIsNullNullReferenceExceptionThrow()
        {
            // arrange
            string         input     = "33";
            List <Student> inputList = null;

            // act
            FormsMethods.FilterList(inputList, input);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
0
        public void FilterListLecturerstWhenResultsIsNullNullArgExceptionThrow()
        {
            // arrange
            List <Lecturer> list = new List <Lecturer>()
            {
                new Lecturer("John", "Mall", "19 avenue", "Cork", "Ireland",
                             "0987U", "345778", "john@gmail", 45, 32435M, "Computer Science")
            };
            string subString = "bac";

            // act
            FormsMethods.FilterList(list, subString);
        }
Beispiel #6
0
        public void FilterListStudentstWhenResultsIsNullNullArgExceptionThrow()
        {
            // arrange
            List <Student> list = new List <Student>()
            {
                new Student("John", "Mall", "19 avenue", "Cork", "Ireland",
                            "0987U", "345778", "john@gmail", Status.PostGrad, 45, "Computer Science")
            };
            string subString = "ad";

            // act
            FormsMethods.FilterList(list, subString);
        }
Beispiel #7
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);
        }
Beispiel #8
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);
        }
Beispiel #9
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);
        }
Beispiel #10
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);
        }
Beispiel #11
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);
        }
Beispiel #12
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);
        }
Beispiel #13
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);
        }
Beispiel #14
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);
        }
Beispiel #15
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);
        }
Beispiel #16
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);
        }
Beispiel #17
0
        public void FilterListStudentsIfTheInputIsNotNumberResultFilteredListBySurname()
        {
            List <Student> listOfStudent = new List <Student>()
            {
                new Student("Mark", "Carling", "19 street", "Dublin", "Ireland",
                            "0897Y", "23456546", "mark@gmail", Status.UnderGrad, 12, "Science"),
                new Student("John", "Thompson", "19 street", "Dublin", "Ireland",
                            "0897Y", "23456546", "john@gmail", Status.UnderGrad, 55, "Arts"),
                new Student("Tommy", "Barrington", "19 street", "Dublin", "Ireland",
                            "0897Y", "23456546", "mark@gmail", Status.PostGrad, 21, "Maths")
            };
            string  input       = "Th";
            Student objExpected = listOfStudent[1];

            //act
            List <Student> filtList = FormsMethods.FilterList(listOfStudent, input);

            // assert
            CollectionAssert.Contains(filtList, objExpected);
        }
Beispiel #18
0
        public void FilterListLecturersIfTheInputIsNotNumberResultFilteredListBySurname()
        {
            List <Lecturer> listOfLecturers = new List <Lecturer>()
            {
                new Lecturer("Mark", "Carling", "19 street", "Dublin", "Ireland",
                             "0897Y", "23456546", "mark@gmail", 12, 32435M, "Science"),
                new Lecturer("John", "Thompson", "19 street", "Dublin", "Ireland",
                             "0897Y", "23456546", "john@gmail", 55, 32453M, "Arts"),
                new Lecturer("Tommy", "Barrington", "19 street", "Dublin", "Ireland",
                             "0897Y", "23456546", "mark@gmail", 21, 12324M, "Maths")
            };
            string   input       = "Ba";
            Lecturer objExpected = listOfLecturers[2];

            //act
            List <Lecturer> filtList = FormsMethods.FilterList(listOfLecturers, input);

            // assert
            CollectionAssert.Contains(filtList, objExpected);
        }
Beispiel #19
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);
        }
Beispiel #20
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);
        }