public void Clone_TruckComparisonEvaluates() { // Arrange Truck suv = new Truck(4); Truck co = (Truck)suv.Clone(); bool[] expected = { true, true }; // Act bool[] actual = new bool[] { (suv.x == co.x), (suv.GetType() == co.GetType()) }; // Assert Assert.Equal(expected, actual); }
private static void Main() { var truck = new Truck(); var driver = new Driver(); var truck2 = truck.Clone() as Truck; var driver2 = driver.Clone() as Driver; if (truck2 != null) { Console.WriteLine("Model: {0}, Weight: {1}", truck.Model, truck2.Weight); } if (driver2 != null) { Console.WriteLine("Age: {0}, Category: {1}", driver2.Age, driver2.Category); } Console.Read(); }