Example #1
0
        public static void TestBaseCtorArgumentConversion()
        {
            var test = new SubClass();
            var v    = test.Value + test.Value;

            Assert.True(v == 2m, "Implicit conversion on base constructor call works when passing 1 to decimal.");

            var test0 = new SubClass0();
            var v0    = test0.Value + test0.Value;

            Assert.True(v0 == 0, "Implicit conversion on base constructor call works when passing 0 to decimal.");

            var test0m = new SubClass0m();
            var v0m    = test0.Value + test0.Value;

            Assert.True(v0m == 0, "Base constructor call works when passing 0m to decimal (explicit conversion).");
        }
Example #2
0
        public static void TestGetTypeInSuperClass()
        {
            ConcreteClass test = new ConcreteClass();

            Assert.AreEqual(
                "Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+ConcreteClass",
                test.TypeProp,
                "Property query for instance:abstract class returns the expected class name.");
            Assert.AreEqual(
                "Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+ConcreteClass",
                test.TypeMethod(),
                "Method query returns the expected class name.");

            SuperClass sup = new SuperClass();

            Assert.AreEqual("Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+SuperClass",
                            sup.TypeProp,
                            "Property query for direct instance of super class returns the expected name.");
            Assert.AreEqual("Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+SuperClass",
                            sup.TypeMethod(),
                            "Method query for direct instance of super class returns the expected name.");

            SubClass sub = new SubClass();

            Assert.AreEqual("Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+SubClass",
                            sub.TypeProp,
                            "Property query for instance of sub class returns the expected name.");
            Assert.AreEqual("Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+SubClass",
                            sub.TypeMethod(),
                            "Method query for instance of sub class returns the expected name.");

            SuperClass subCast = (SuperClass)sub;

            Assert.AreEqual("Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+SubClass",
                            subCast.TypeProp,
                            "Property query for cast instance of super class returns the expected name.");
            Assert.AreEqual("Bridge.ClientTest.Batch3.BridgeIssues.Bridge3426+SubClass",
                            subCast.TypeMethod(),
                            "Method query for cast instance of super class returns the expected name.");
        }