Beispiel #1
0
        public static void RunCloneTest()
        {
            Sheep blackie = new Sheep()
            {
                Name = "Blackie"
            };

            RunTest(blackie, 2);
            Sheep dolly = (Sheep)blackie.Clone();

            dolly.Name = "Dolly";
            RunTest(dolly, 3);
            RunTest(blackie, 1);
        }
Beispiel #2
0
        public static void RunSheep()
        {
            Sheep sheep = new Sheep("Blackie");

            CountUtil.Count(sheep, 2);


            Console.WriteLine("Now, let us clone Blackie!");
            Sheep  clone     = sheep.Clone() as Sheep;
            string cloneName = Validation.GetName("\nVhat vould you like to name the clone? ");

            clone.Name = cloneName;
            clone.ResetCount();
            int userNumber = Validation.GetNumber($"\nHow many times vould you like to count {cloneName}? ");

            CountUtil.Count(clone, userNumber);
            sheep.ResetCount();

            CountUtil.Count(sheep, 1);
        }