示例#1
0
        public void TestAsClass()
        {
            var obj    = TestClassWithCtor.ExampleInstance;
            var newObj = new TestClassWithCtor(obj, false);

            Assert.IsTrue(obj.FieldA == newObj.FieldA);
            Assert.IsTrue(obj.PropA == newObj.PropA);
            Assert.IsTrue(obj.PropB == newObj.PropB);
            Assert.IsTrue(obj.PropC == newObj.PropC);
            Assert.IsTrue(newObj.VirtA == null);

            var newObjWithVirt = new TestClassWithCtor(obj, true);

            Assert.IsTrue(obj.FieldA == newObjWithVirt.FieldA);
            Assert.IsTrue(obj.PropA == newObjWithVirt.PropA);
            Assert.IsTrue(obj.PropB == newObjWithVirt.PropB);
            Assert.IsTrue(obj.PropC == newObjWithVirt.PropC);
            Assert.IsTrue(obj.VirtA == newObjWithVirt.VirtA);
        }
示例#2
0
 public static bool ClassWithCtorParam(TestClassWithCtor x)
 {
     return(x == null);
 }
示例#3
0
 public TestClassWithCtor(TestClassWithCtor @base, bool copyVirtual)
 {
     _copier(@base, this, copyVirtual);
 }