public void Test_ScheduleWriterNew() { int startHour = 9; MemoryStream ms = new MemoryStream(); StreamWriter sw = new StreamWriter(ms); IScheduleWriter o = new ScheduleWriter(sw); ISchedule sh = new Schedule(startHour); Assert.AreNotSame(sh, null); }
public void Test_writeHeader() { MemoryStream ms = new MemoryStream(); StreamWriter sw = new StreamWriter(ms); IScheduleWriter o = new ScheduleWriter(sw); o.writeHeader(2); string expected = "\r\nTeam 2 :\r\n"; string actual = readStream(ms, sw, expected.Length); Assert.AreEqual(expected, actual); }
public void Test_write() { string task1 = "AAAA sprint"; string task2 = "BBBB 10min"; string task3 = "CCCC 20min"; int startHour = 9; MemoryStream ms = new MemoryStream(); StreamWriter sw = new StreamWriter(ms); IScheduleWriter o = new ScheduleWriter(sw); ISchedule sh = new Schedule(startHour); sh.addIfSlotAvailable(new Activity(task1)); sh.addIfSlotAvailable(new Activity(task2)); sh.addIfSlotAvailable(new Activity(task3)); o.write(sh); string actual = readStream(ms, sw); string expected = "0" + startHour.ToString() + ":00 AM : " + task1 + "\r\n" + "0" + startHour.ToString() + ":15 AM : " + task2 + "\r\n" + "0" + startHour.ToString() + ":25 AM : " + task3 + "\r\n"; Assert.AreEqual(expected, actual); }