public void CloneDerived()
		{
			ClonableDerived d = new ClonableDerived { Count = 3, Name = "Test" };
			ClonableDerived d2 = d.Clone();
			Assert.That(d2, Is.Not.SameAs(d));
			Assert.That(d2.Count, Is.EqualTo(d.Count));
			Assert.That(d2.Name, Is.EqualTo(d.Name));
		}
		public void CloneDerivedAsBase()
		{
			ClonableBase b = new ClonableDerived { Count = 3, Name = "Test" };
			ClonableBase b2 = b.Clone();
			Assert.That(b2, Is.Not.SameAs(b));
			Assert.That(b2.Count, Is.EqualTo(b.Count));
			Assert.That(b2, Is.TypeOf<ClonableDerived>());
			Assert.That(((ClonableDerived) b2).Name, Is.EqualTo(((ClonableDerived) b).Name));
		}
Example #3
0
        public void CloneDerived()
        {
            ClonableDerived d = new ClonableDerived {
                Count = 3, Name = "Test"
            };
            ClonableDerived d2 = d.Clone();

            Assert.That(d2, Is.Not.SameAs(d));
            Assert.That(d2.Count, Is.EqualTo(d.Count));
            Assert.That(d2.Name, Is.EqualTo(d.Name));
        }
Example #4
0
        public void CloneDerivedAsBase()
        {
            ClonableBase b = new ClonableDerived {
                Count = 3, Name = "Test"
            };
            ClonableBase b2 = b.Clone();

            Assert.That(b2, Is.Not.SameAs(b));
            Assert.That(b2.Count, Is.EqualTo(b.Count));
            Assert.That(b2, Is.TypeOf <ClonableDerived>());
            Assert.That(((ClonableDerived)b2).Name, Is.EqualTo(((ClonableDerived)b).Name));
        }
Example #5
0
 protected ClonableDerived(ClonableDerived other)
     : base(other)
 {
     Name = other.Name;
 }
		protected ClonableDerived(ClonableDerived other)
			: base(other)
		{
			Name = other.Name;
		}