コード例 #1
0
    public bool PosTest1() 
    {
        bool retVal = true;
        TestLibrary.TestFramework.BeginScenario("Verify invoke eventhandler using non-static method...");

        try
        {
            EventHandlerInvoke delctor = new EventHandlerInvoke();
            delctor.myHandler = new EventHandler(new MyClass().Test1);
            EventArgs e = new EventArgs();
            int i = Counter.count;
            delctor.myHandler.Invoke(null, e);

            if (i!=Counter.count-1)
            {
                TestLibrary.TestFramework.LogError("001", "Invoke method is not invoked!");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }
コード例 #2
0
ファイル: eventhandlerinvoke.cs プロジェクト: yukitos/coreclr
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("Verify invoke eventhandler using static method...");

        try
        {
            EventHandlerInvoke delctor = new EventHandlerInvoke();
            delctor.myHandler = new EventHandler(new MyClass().Test1);
            EventArgs e = new EventArgs();
            int       i = Counter.count;
            delctor.myHandler.Invoke(new MyClass(), e);

            if (i != Counter.count - 1)
            {
                TestLibrary.TestFramework.LogError("001", "Invoke method is not invoked!");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
            retVal = false;
        }

        return(retVal);
    }
コード例 #3
0
    public static int Main()
    {
        EventHandlerInvoke testObj = new EventHandlerInvoke();

        TestLibrary.TestFramework.BeginTestCase("for Method of System.EventHandler");
        if (testObj.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }
コード例 #4
0
    public static int Main()
    {
        EventHandlerInvoke testObj = new EventHandlerInvoke();
        TestLibrary.TestFramework.BeginTestCase("for Method of System.EventHandler");
        if (testObj.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }

    }
コード例 #5
0
    public static int Main(string[] args)
    {
        EventHandlerInvoke invoke =
            new EventHandlerInvoke();
        TestLibrary.TestFramework.BeginTestCase("Testing EventHandler.Invoke(System.Object,System.EventArgs,System.AsyncCallback,System.Object)...");

        if (invoke.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }
コード例 #6
0
ファイル: eventhandlerinvoke.cs プロジェクト: yukitos/coreclr
    public static int Main(string[] args)
    {
        EventHandlerInvoke invoke =
            new EventHandlerInvoke();

        TestLibrary.TestFramework.BeginTestCase("Testing EventHandler.Invoke(System.Object,System.EventArgs,System.AsyncCallback,System.Object)...");

        if (invoke.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }