Ejemplo n.º 1
0
        public void TestAnimalSaveNullFileName()
        {
            Administration admin = new Administration();

            admin.Save(null);
        }
Ejemplo n.º 2
0
        public void TestSaveAndLoadFunctionality()
        {
            string filename = Path.GetTempFileName();

            Administration shelter_helmond = new Administration();
            Administration shelter_eindhoven = 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;

            shelter_helmond.Add(a);
            shelter_helmond.Add(b);
            shelter_helmond.Add(c);
            shelter_helmond.Add(d);

            shelter_helmond.Save(filename);

            shelter_eindhoven.Load(filename);

            Assert.AreEqual(4, shelter_eindhoven.Animals.Count);

            Assert.AreEqual("Dog: 0, 01-02-2013, Ramzes, not reserved, €200.00, unknown", shelter_eindhoven.Animals[0].ToString(), false);
            Assert.AreEqual("Cat: 1, 02-03-2014, Hello Kitty, reserved, €60.00, none", shelter_eindhoven.Animals[1].ToString(), false);
            Assert.AreEqual("Dog: 62345, 11-12-2011, Jannetje, not reserved, €350.00, 04-04-2015", shelter_eindhoven.Animals[2].ToString(), false);
            Assert.AreEqual("Cat: 62346, 01-01-2000, KatjeXWithSWAG, not reserved, €42.00, Heeft te veel SWAG", shelter_eindhoven.Animals[3].ToString(), false);

            File.Delete(filename);
        }
Ejemplo n.º 3
0
        public void TestAnimalSaveEmptyFileName()
        {
            Administration admin = new Administration();

            admin.Save("");
        }