示例#1
0
文件: main.cs 项目: yukozh/coreclr
    static void TestMovedVirtualMethods()
    {
        var o = new MyChildClass();

        Assert.AreEqual(o.MovedToBaseClass(), "MovedToBaseClass");
        Assert.AreEqual(o.ChangedToVirtual(), "ChangedToVirtual");

        if (!LLILCJitEnabled)
        {
            o = null;

            try
            {
                o.MovedToBaseClass();
            }
            catch (NullReferenceException)
            {
                try
                {
                    o.ChangedToVirtual();
                }
                catch (NullReferenceException)
                {
                    return;
                }
            }

            Assert.AreEqual("NullReferenceException", "thrown");
        }
    }
示例#2
0
文件: main.cs 项目: bjjones/coreclr
    static void TestMovedVirtualMethods()
    {
        var o = new MyChildClass();

        Assert.AreEqual(o.MovedToBaseClass(), "MovedToBaseClass");
        Assert.AreEqual(o.ChangedToVirtual(), "ChangedToVirtual");

        o = null;

        try
        {
            o.MovedToBaseClass();
        }
        catch (NullReferenceException)
        {
            try
            {
                o.ChangedToVirtual();
            }
            catch (NullReferenceException)
            {
                return;
            }
        }

        Assert.AreEqual("NullReferenceException", "thrown");
    }
示例#3
0
    static void TestMovedVirtualMethods()
    {
        var o = new MyChildClass();

        Assert.AreEqual(o.MovedToBaseClass(), "MovedToBaseClass");
        Assert.AreEqual(o.ChangedToVirtual(), "ChangedToVirtual");
    }
示例#4
0
 public MyClass()
 {
     Name       = "Name";
     Name2      = "Name2";
     Name3      = "Name3";
     Name4      = "Name4";
     Name5      = "Name5";
     ChildClass = new MyChildClass();
 }
示例#5
0
    static void TestMovedVirtualMethodsOnNullReference()
    {
        MyChildClass o = null;

        try
        {
            o.MovedToBaseClass();
        }
        catch (NullReferenceException)
        {
            try
            {
                o.ChangedToVirtual();
            }
            catch (NullReferenceException)
            {
                return;
            }
        }

        Assert.AreEqual("NullReferenceException", "thrown");
    }
示例#6
0
 public RootClass2()
 {
     Child = new MyChildClass();
 }