예제 #1
0
        public void CloneTest()
        {
            var a1 = new Plane <ReactiveEngine>(cap, capTank, model, reEngine);
            var a3 = new Helicopter <GasTurbineEngine>(cap, capTank, model, hEngine);
            Plane <ReactiveEngine>        a2 = (Plane <ReactiveEngine>)a1.Clone();
            Helicopter <GasTurbineEngine> a4 = (Helicopter <GasTurbineEngine>)a3.Clone();

            Assert.AreEqual(a1.Capacity, a2.Capacity);
            Assert.AreEqual(a1.TankCapacity, a2.TankCapacity);
            Assert.AreEqual(a1.Engine, a2.Engine);
            Assert.AreEqual(a3.Capacity, a4.Capacity);
            Assert.AreEqual(a3.TankCapacity, a4.TankCapacity);
            Assert.AreEqual(a3.Engine, a4.Engine);
        }