public void ConstructorTest() { FunES62AnimalsAndInheritance.Dog doug = new FunES62AnimalsAndInheritance.Dog("Doug", 12, "Serving his master", "Eliza"); Assert.AreEqual("Doug", doug.Name); Assert.AreEqual(12, doug.Age); Assert.AreEqual(4, doug.Legs); Assert.AreEqual("dog", doug.Species); Assert.AreEqual("Serving his master", doug.Status); Assert.AreEqual("Hello Eliza", doug.GreetMaster()); }
public void RandomTest() { for (int i = 0; i < 100; ++i) { string a = Utility.RandomToken(); int b = Utility.RandomAge(); string c = Utility.RandomToken(), d = Utility.RandomToken(); FunES62AnimalsAndInheritance.Dog s = new FunES62AnimalsAndInheritance.Dog(a, b, c, d); Assert.AreEqual(a, s.Name); Assert.AreEqual(b, s.Age); Assert.AreEqual(4, s.Legs); Assert.AreEqual("dog", s.Species); Assert.AreEqual(c, s.Status); Assert.AreEqual($"Hello, my name is {a} and I am {b} years old.", s.Introduce()); Assert.AreEqual($"Hello {d}", s.GreetMaster()); } }