public void T004_Student_Reschedule() { bool result = false; //Classes for test ScheduleItem class1 = new ScheduleItem("Class1", new TimeHHMM(8, 30), 30); ScheduleItem class2 = new ScheduleItem("Class2", new TimeHHMM(9, 30), 30); ScheduleItem class2moved = new ScheduleItem("Class2", new TimeHHMM(12, 30), 30); //Student for test Student testStudent = new Student("Jane", "Doe"); //Build basic, valid schedule result = testStudent.AddClass(class1); Assert.IsTrue(result); result = testStudent.AddClass(class2); Assert.IsTrue(result); Assert.AreEqual<int>(2, testStudent.StudentSchedule.Count); /** Nominal reschedule */ result = testStudent.Reschedule(class2.ItemName, new TimeHHMM(12, 30)); Assert.IsTrue(result); Assert.AreEqual<int>(2, testStudent.StudentSchedule.Count); //Still only 2 classes in schedule /** Conflict reschedule */ result = testStudent.Reschedule(class2.ItemName, new TimeHHMM(8, 45)); Assert.IsFalse(result); result = testStudent.GetClass(class1.ItemName) == class1; Assert.IsTrue(result); //Class1 hasn't moved result = testStudent.GetClass(class2moved.ItemName) == class2moved; Assert.IsTrue(result); //Class2 is still in modified location }
public void T003_Student_GetClass() { bool result = false; /** Classes for test */ ScheduleItem class1 = new ScheduleItem("Class1", new TimeHHMM(8, 30), 30); ScheduleItem class2 = new ScheduleItem("Class2", new TimeHHMM(9, 30), 30); ScheduleItem foundClass; /** Student for test */ Student testStudent = new Student("Jane", "Doe"); //Build basic, valid schedule result = testStudent.AddClass(class1); Assert.IsTrue(result); result = testStudent.AddClass(class2); Assert.IsTrue(result); Assert.AreEqual<int>(2, testStudent.StudentSchedule.Count); //Nominal GetClass foundClass = testStudent.GetClass(class1.ItemName); Assert.AreEqual<ScheduleItem>(class1, foundClass); foundClass = testStudent.GetClass(class2.ItemName); Assert.AreEqual<ScheduleItem>(class2, foundClass); //Failed GetClass foundClass = testStudent.GetClass("Class3"); Assert.AreEqual<object>(null, (object)foundClass); }