public void TestAnimalExportNullFileName() { Administration admin = new Administration(); admin.Export(null); }
public void TestExportFunctionality() { string filename = Path.GetTempFileName(); Administration admin = new Administration(); Dog a = new Dog(0, new SimpleDate(1, 2, 2013), "Ramzes", null); Cat b = new Cat(1, new SimpleDate(2, 3, 2014), "Hello Kitty", null); Dog c = new Dog(62345, new SimpleDate(11, 12, 2011), "Jannetje", new SimpleDate(4, 4, 2015)); Cat d = new Cat(62346, new SimpleDate(1, 1, 2000), "KatjeXWithSWAG", "Heeft te veel SWAG"); b.IsReserved = true; admin.Add(a); admin.Add(b); admin.Add(c); admin.Add(d); admin.Export(filename); string[] text = File.ReadAllLines(filename); Assert.AreEqual("Dog: 0, 01-02-2013, Ramzes, not reserved, €200.00, unknown", text[0], false); Assert.AreEqual("Cat: 1, 02-03-2014, Hello Kitty, reserved, €60.00, none", text[1], false); Assert.AreEqual("Dog: 62345, 11-12-2011, Jannetje, not reserved, €350.00, 04-04-2015", text[2], false); Assert.AreEqual("Cat: 62346, 01-01-2000, KatjeXWithSWAG, not reserved, €42.00, Heeft te veel SWAG", text[3], false); File.Delete(filename); }
public void TestAnimalExportEmptyFileName() { Administration admin = new Administration(); admin.Export(""); }