Ejemplo n.º 1
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Return type is void, parameter is a reference value");

        try
        {
            DelegateDefinitions dd = new DelegateDefinitions();
            dd.ReferenceParameterVoidDelegate =
                new ReferenceParameterVoidDelegate(dd.TestReferenceParameterVoidCallback);
            if (null == dd.ReferenceParameterVoidDelegate)
            {
                TestLibrary.TestFramework.LogError("003", "Failed to assign a call back function to a delegate");
                retVal = false;
            }

            dd.ReferenceParameterVoidDelegate(DelegateDefinitions.c_DELEGATE_TEST_DEFAUTL_REFERENCE_PARAMETER);
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
Ejemplo n.º 2
0
    public bool NegTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("NegTest1: Return type is void, parameter is a reference value");

        try
        {
            DelegateDefinitions dd = new DelegateDefinitions();
            dd.ReferenceParameterVoidDelegate =
                new ReferenceParameterVoidDelegate(dd.TestReferenceParameterVoidCallbackWithNullValue);

            dd.ReferenceParameterVoidDelegate(null);
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("048", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
Ejemplo n.º 3
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Return type is void, parameter is a reference value");

        try
        {
            DelegateDefinitions dd = new DelegateDefinitions();
            dd.ReferenceParameterVoidDelegate =
                new ReferenceParameterVoidDelegate(dd.TestReferenceParameterVoidCallback);
            if (null == dd.ReferenceParameterVoidDelegate)
            {
                TestLibrary.TestFramework.LogError("003", "Failed to assign a call back function to a delegate");
                retVal = false;
            }

            dd.ReferenceParameterVoidDelegate(DelegateDefinitions.c_DELEGATE_TEST_DEFAUTL_REFERENCE_PARAMETER);
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }        

        return retVal;
    }
Ejemplo n.º 4
0
    public bool NegTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("NegTest1: Return type is void, parameter is a reference value");

        try
        {
            DelegateDefinitions dd = new DelegateDefinitions();
            dd.ReferenceParameterVoidDelegate =
                new ReferenceParameterVoidDelegate(dd.TestReferenceParameterVoidCallbackWithNullValue);

            dd.ReferenceParameterVoidDelegate(null);
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("048", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }