Ejemplo n.º 1
0
    private static void StaticCtorTest()
    {
        BeforeFieldInitTest.Nop();
        if (StaticsInited.BeforeFieldInitInited)
        {
            PrintLine("BeforeFieldInitType inited too early");
        }
        else
        {
            int x = BeforeFieldInitTest.TestField;
            if (StaticsInited.BeforeFieldInitInited)
            {
                PrintLine("BeforeFieldInit test: Ok.");
            }
            else
            {
                PrintLine("BeforeFieldInit cctor not run");
            }
        }

        NonBeforeFieldInitTest.Nop();
        if (StaticsInited.NonBeforeFieldInitInited)
        {
            PrintLine("NonBeforeFieldInit test: Ok.");
        }
        else
        {
            PrintLine("NonBeforeFieldInitType cctor not run");
        }
    }
Ejemplo n.º 2
0
    private static void StaticCtorTest()
    {
        BeforeFieldInitTest.Nop();
        if (StaticsInited.BeforeFieldInitInited)
        {
            PrintLine("BeforeFieldInitType inited too early");
        }
        else
        {
            StartTest("BeforeFieldInit test");
            int x = BeforeFieldInitTest.TestField;
            EndTest(StaticsInited.BeforeFieldInitInited, "cctor not run");
        }

        StartTest("NonBeforeFieldInit test");
        NonBeforeFieldInitTest.Nop();
        EndTest(StaticsInited.NonBeforeFieldInitInited, "cctor not run");
    }