public void RandomTest() { for (int i = 0; i < 100; ++i) { string a = Utility.RandomToken(); int b = Utility.RandomAge(); string c = Utility.RandomToken(); FunES62AnimalsAndInheritance.Shark s = new FunES62AnimalsAndInheritance.Shark(a, b, c); Assert.AreEqual(a, s.Name); Assert.AreEqual(b, s.Age); Assert.AreEqual(0, s.Legs); Assert.AreEqual("shark", s.Species); Assert.AreEqual(c, s.Status); Assert.AreEqual($"Hello, my name is {a} and I am {b} years old.", s.Introduce()); } }
public void ConstructorTest() { FunES62AnimalsAndInheritance.Shark billy = new FunES62AnimalsAndInheritance.Shark("Billy", 3, "Alive and well"); Assert.AreEqual("Billy", billy.Name); Assert.AreEqual(3, billy.Age); Assert.AreEqual(0, billy.Legs); Assert.AreEqual("shark", billy.Species); Assert.AreEqual("Alive and well", billy.Status); Assert.AreEqual("Hello, my name is Billy and I am 3 years old.", billy.Introduce()); FunES62AnimalsAndInheritance.Shark charles = new FunES62AnimalsAndInheritance.Shark("Charles", 8, "Looking for a mate"); Assert.AreEqual("Charles", charles.Name); Assert.AreEqual(8, charles.Age); Assert.AreEqual(0, charles.Legs); Assert.AreEqual("shark", charles.Species); Assert.AreEqual("Looking for a mate", charles.Status); Assert.AreEqual("Hello, my name is Charles and I am 8 years old.", charles.Introduce()); }