public void init() { resource1 = new Resource("TV"); resource2 = new Resource("Projector"); resource3 = new Resource("PC"); resources1 = new List<Resource>() { resource1, resource2 }; resources2 = new List<Resource>() { resource1, resource3 }; room = new Room(10, resources1); start = DateTime.Now; end = start.AddMinutes(30); broom1 = new BookableRoom(start, end, room); broom2 = new BookableRoom(start.AddMinutes(1), start.AddMinutes(41), new Room(20, resources2)); course1 = new Course(30, 10, resources1); course2 = new Course(40, 20, resources2); broomList1 = new List<BookableRoom>() { broom1, broom2 }; broomList2 = new List<BookableRoom>() { (BookableRoom)broom1.Clone(), (BookableRoom)broom2.Clone() }; day1 = new Day(broomList1); day2 = new Day(broomList2); }
public Timetable generateDefaultTimeTable() { // Resources Resource resource1 = new Resource("Projector"); List<Resource> resources = new List<Resource>() { resource1 }; // Rooms Room room1 = new Room("001", 30, resources); Room room2 = new Room("112", 30, null); Room room3 = new Room("110", 35, resources); // Set Room avalability BookableRoom book1 = new BookableRoom(Extensions.DateTimeCreator(0, 8, 30), Extensions.DateTimeCreator(0, 16, 0), room1); BookableRoom book2 = new BookableRoom(Extensions.DateTimeCreator(0, 8, 30), Extensions.DateTimeCreator(0, 16, 0), room2); BookableRoom book3 = new BookableRoom(Extensions.DateTimeCreator(0, 8, 30), Extensions.DateTimeCreator(0, 16, 0), room3); List<BookableRoom> rooms1 = new List<BookableRoom>() { (BookableRoom)book1.Clone(), (BookableRoom)book2.Clone() }; List<BookableRoom> rooms2 = new List<BookableRoom>() { (BookableRoom)book2.Clone(), (BookableRoom)book3.Clone() }; List<BookableRoom> rooms3 = new List<BookableRoom>() { (BookableRoom)book1.Clone(), (BookableRoom)book3.Clone() }; // Days Day day1 = new Day(1, rooms1); Day day2 = new Day(2, rooms2); Day day3 = new Day(3, rooms3); // Timetable Timetable timetable = new Timetable(new List<Day>() { day1, day2, day3 }); return timetable; }
public void Fit_OnlyOnce() { broom1 = new BookableRoom(start, end, room); broom2 = (BookableRoom)broom1.Clone(); broomList1 = new List<BookableRoom>() { broom1, broom2 }; day1 = new Day(broomList1); Assert.IsTrue(day1.Fit(course1)); var fits = day1.Rooms.Where(roomX => roomX.IsCourseBooked(course1)).ToList(); Assert.AreEqual(1, fits.Count); }