Esempio n. 1
0
        public static void SampleData()
        {
            try
            {
                Staff teacher = new Staff("Neil Urqhart", "C59 Merchiston", "*****@*****.**", 9253, "Software Engineering", "Lecturer");
                StaffList.Add(teacher);

                Module subject = new Module("Software Dev 2", "SET08108", teacher);
                ModuleList.Add(subject);

                teacher = new Staff("Ben Kenwright", "C48 Merchiston", "*****@*****.**", 9876, "Digital Media", "Lecturer");
                StaffList.Add(teacher);

                subject = new Module("Computer Graphics", "IMD09132", teacher);
                ModuleList.Add(subject);

                teacher = new Staff("Brian Davidson", "C56 Merchiston", "*****@*****.**", 9267, "Computing", "Lecturer");
                StaffList.Add(teacher);

                subject = new Module("Database Systems", "INF08104", teacher);
                ModuleList.Add(subject);

                teacher = new Staff("Andrew Cumming", "C39 Merchiston", "*****@*****.**", 9112, "Software Engineering", "Senior Lecturer");
                StaffList.Add(teacher);

                subject = new Module("Web Technologies", "SET08101", teacher);
                ModuleList.Add(subject);

                teacher = new Staff("Sally Smith", "C66 Merchiston", "*****@*****.**", 9005, "Computing", "Senior Lecturer");
                StaffList.Add(teacher);

                subject = new Module("Mobile Apps", "SET08114", teacher);
                ModuleList.Add(subject);

                Student pupil = new Student("Bill Grimes", "22 Houslane", "*****@*****.**", 1020);
                StudentList.Add(pupil);

                pupil = new Student("Sophie Jackson", "6/6 Longstreet", "*****@*****.**", 1453);
                StudentList.Add(pupil);

                pupil = new Student("Jim Watt", "37 Dell AV", "*****@*****.**", 4532);
                StudentList.Add(pupil);

                pupil = new Student("Helen Doul", "6 Mainstreet", "*****@*****.**", 4562);
                StudentList.Add(pupil);

                pupil = new Student("Jannet Mole", "15 Crossdale", "*****@*****.**", 8763);
                StudentList.Add(pupil);
            }
            catch (ArgumentNullException)
            {

            }
            catch (ArgumentOutOfRangeException)
            {

            }
         

        }
Esempio n. 2
0
 public void ValidModuleCreation()
 {
     //arrange
     Staff staff = new Staff("Joe Blogs", "22 Houselane", "*****@*****.**", 9001, "Software Engineering", "Lecturer");
     string name = "Software Dev 2";
     string code = "SET001";
     Staff leader = staff;
     int expectedNoOfModCodes = 1;
     //act
     Module testModule = new Module(name, code, leader);
     //asert
     int actualNoOFModCodes = Module.UsedModuleCodes.Count;
     Assert.AreEqual(expectedNoOfModCodes, actualNoOFModCodes, 0, "number of module codes does not match");
 }
Esempio n. 3
0
 public void ModuleCreationNonUniqueModCode_ShouldThrowOutOfRange()
 {
     Staff staff = new Staff("Joe Blogs", "22 Houselane", "*****@*****.**", 9005, "Software Engineering", "Lecturer");
     //arrange
     string name = "Web Tech";
     string code = "SET001";
     Staff leader = staff;
     try
     {
         //act
         Module testMod = new Module(name, code, leader);
     }
     catch (ArgumentOutOfRangeException e)
     {
         //assert
         StringAssert.Contains(e.Message, Module.ModuleCodeIsNotUniqueMessage);
         return;
     }
     Assert.Fail("no exception thrown");
 }
Esempio n. 4
0
 public void ModuleCreationBlankName_ShouldThrowNull()
 {
     Staff staff = new Staff("Joe Blogs", "22 Houselane", "*****@*****.**", 9003, "Software Engineering", "Lecturer");
     //arrange
     string name = "";
     string code = "SET002";
     Staff leader = staff;
     try
     {
         //act
         Module testMod = new Module(name, code, leader);
     }
     catch(ArgumentNullException e)
     {
         //assert
         StringAssert.Contains(e.Message, Module.NameBlankMessage);
         return;
     }
     Assert.Fail("no exception thrown");
 }
Esempio n. 5
0
 public void ModuleCreationStaffDoesNotExist_ShouldThrowOutOfRange()
 {
     Staff staff;
     //arrange
     string name = "Web Tech";
     string code = "SET005";
     Staff leader = staff;
     try
     {
         //act
         Module testMod = new Module(name, code, leader);
     }
     catch (ArgumentOutOfRangeException e)
     {
         //assert
         StringAssert.Contains(e.Message, Module.ModuleLeaderDoesNotExistMessage);
         return;
     }
     Assert.Fail("no exception thrown");
 }