public void TestICSFileLoadAll() { List<Room> myRooms = new Room[]{ new Room { RoomNumber = "RES-PHAR-129", Uri = new Uri(Path.Combine(Directory.GetCurrentDirectory(), "../../fixture/RES-PHAR-129.ics")) } }.ToList(); RoomInfo ri = new RoomInfo(myRooms); Assert.IsTrue(ri.LoadAll()); }
public void TestSerialization() { var myTestFile = "../../fixture/testserialization.xml"; File.Delete(myTestFile); List<Room> myRooms = new Room[] { new Room { RoomNumber = "RES-PHAR-129", Uri = new Uri(Path.Combine(Directory.GetCurrentDirectory(), "../../fixture/RES-PHAR-129.ics")) }, new Room { RoomNumber = "RES-PHAR-226", Uri = new Uri(Path.Combine(Directory.GetCurrentDirectory(), "../../fixture/RES-PHAR-129.ics")) } }.ToList(); RoomInfo ri = new RoomInfo(myRooms); ri.LoadAll(); ri.SerializeCacheToFile(myTestFile); Assert.IsTrue(File.Exists(myTestFile)); // Now load... RoomInfo ri2 = new RoomInfo(myRooms); ri.DeserializeCacheFromFile(myTestFile); //Longer assert...We should have the same output Assert.AreEqual(ri.GetRoomByName("RES-PHAR-129").BusyTimes(), ri2.GetRoomByName("RES-PHAR-129").BusyTimes()); Assert.AreEqual(ri.GetRoomByName("RES-PHAR-226").BusyTimes(), ri2.GetRoomByName("RES-PHAR-226").BusyTimes()); //Cleanup File.Delete(myTestFile); }
public void TestLoadOfSingleRoomWithDefaultURI() { RoomInfo ri = new RoomInfo(new Uri("../../fixture/classrooms.xml", UriKind.Relative)); Assert.IsTrue(ri.LoadRoomByName("PHAR-129")); }
public void TestLoadAllOfNoRooms() { List<Room> myRooms = new Room[] {}.ToList(); RoomInfo ri = new RoomInfo(myRooms); Assert.IsFalse(ri.LoadAll()); }
public void TestExceptionSingleLoad() { RoomInfo ri = new RoomInfo(new Uri("../../fixture/classrooms.xml", UriKind.Relative)); Assert.IsTrue(ri.LoadRoomByName("omg hax hax")); }
public void TestXMLLoadAll() { RoomInfo ri = new RoomInfo(new Uri(Path.Combine(Directory.GetCurrentDirectory(), "../../fixture/classrooms.xml"))); //RoomInfo ri = new RoomInfo(); Assert.IsTrue(ri.LoadAll()); }