예제 #1
0
파일: main.cs 프로젝트: yukozh/coreclr
    static void TestMovedGenericVirtualMethod()
    {
        var o = new MyChildGeneric <Object>();

        Assert.AreEqual(o.MovedToBaseClass <WeakReference>(), typeof(List <WeakReference>).ToString());
        Assert.AreEqual(o.ChangedToVirtual <WeakReference>(), typeof(List <WeakReference>).ToString());

        if (!LLILCJitEnabled)
        {
            o = null;

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

            Assert.AreEqual("NullReferenceException", "thrown");
        }
    }
예제 #2
0
    static void TestMovedGenericVirtualMethod()
    {
        var o = new MyChildGeneric <Object>();

        Assert.AreEqual(o.MovedToBaseClass <WeakReference>(), typeof(List <WeakReference>).ToString());
        Assert.AreEqual(o.ChangedToVirtual <WeakReference>(), typeof(List <WeakReference>).ToString());
    }
예제 #3
0
    static void TestGenericOverStruct()
    {
        var o1 = new MyGeneric <String, MyGrowingStruct>();

        Assert.AreEqual(o1.GenericVirtualMethod <MyChangingStruct, IEnumerable <Program> >(),
                        "System.StringMyGrowingStructMyChangingStructSystem.Collections.Generic.IEnumerable`1[Program]");

        var o2 = new MyChildGeneric <MyChangingStruct>();

        Assert.AreEqual(o2.MovedToBaseClass <MyGrowingStruct>(), typeof(List <MyGrowingStruct>).ToString());
        Assert.AreEqual(o2.ChangedToVirtual <MyGrowingStruct>(), typeof(List <MyGrowingStruct>).ToString());
    }
예제 #4
0
    static void TestMovedGenericVirtualMethodOnNullReference()
    {
        MyChildGeneric <Object> o = null;

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

        Assert.AreEqual("NullReferenceException", "thrown");
    }
예제 #5
0
파일: main.cs 프로젝트: bjjones/coreclr
    static void TestMovedGenericVirtualMethod()
    {
        var o = new MyChildGeneric<Object>();

        Assert.AreEqual(o.MovedToBaseClass<WeakReference>(), typeof(List<WeakReference>).ToString());
        Assert.AreEqual(o.ChangedToVirtual<WeakReference>(), typeof(List<WeakReference>).ToString());

        o = null;

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

        Assert.AreEqual("NullReferenceException", "thrown");
    }