public void RandomTest() { for (int i = 0; i < 100; ++i) { string a = Utility.RandomToken(); int b = Utility.RandomAge(); string c = Utility.RandomToken(); FunES62AnimalsAndInheritance.Cat s = new FunES62AnimalsAndInheritance.Cat(a, b, c); Assert.AreEqual(a, s.Name); Assert.AreEqual(b, s.Age); Assert.AreEqual(4, s.Legs); Assert.AreEqual("cat", s.Species); Assert.AreEqual(c, s.Status); Assert.AreEqual($"Hello, my name is {a} and I am {b} years old. Meow meow!", s.Introduce()); } }
public void ConstructorTest() { FunES62AnimalsAndInheritance.Cat cathy = new FunES62AnimalsAndInheritance.Cat("Cathy", 7, "Playing with a ball of yarn"); Assert.AreEqual("Cathy", cathy.Name); Assert.AreEqual(7, cathy.Age); Assert.AreEqual(4, cathy.Legs); Assert.AreEqual("cat", cathy.Species); Assert.AreEqual("Playing with a ball of yarn", cathy.Status); Assert.AreEqual("Hello, my name is Cathy and I am 7 years old. Meow meow!", cathy.Introduce()); FunES62AnimalsAndInheritance.Cat spitsy = new FunES62AnimalsAndInheritance.Cat("Spitsy", 6, "sleeping"); Assert.AreEqual("Spitsy", spitsy.Name); Assert.AreEqual(6, spitsy.Age); Assert.AreEqual(4, spitsy.Legs); Assert.AreEqual("cat", spitsy.Species); Assert.AreEqual("sleeping", spitsy.Status); Assert.AreEqual("Hello, my name is Spitsy and I am 6 years old. Meow meow!", spitsy.Introduce()); }