public bool PosTest5() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("PosTest5: Return type is reference type, with a reference parameter"); try { DelegateDefinitions dd = new DelegateDefinitions(); dd.ReferenceParameterReferenceDelegate = new ReferenceParameterReferenceDelegate(dd.TestReferenceParameterReferenceCallback); if (null == dd.ReferenceParameterReferenceDelegate) { TestLibrary.TestFramework.LogError("011", "Failed to assign a call back function to a delegate"); retVal = false; } object returnObject = dd.ReferenceParameterReferenceDelegate(DelegateDefinitions.c_DELEGATE_TEST_DEFAUTL_REFERENCE_PARAMETER); if (!returnObject.Equals(DelegateDefinitions.c_DELEGATE_TEST_DEFAUTL_REFERENCE_PARAMETER)) { TestLibrary.TestFramework.LogError("012", "Incorrect delegate return value: " + returnObject); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("013", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return(retVal); }
public bool NegTest2() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("NegTest2: Return type is reference, parameter is a reference value"); try { DelegateDefinitions dd = new DelegateDefinitions(); dd.ReferenceParameterReferenceDelegate = new ReferenceParameterReferenceDelegate(dd.TestReferenceParameterReferenceCallbackWithNullValue); dd.ReferenceParameterReferenceDelegate(null); } catch (Exception e) { TestLibrary.TestFramework.LogError("049", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return(retVal); }
public bool NegTest2() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("NegTest2: Return type is reference, parameter is a reference value"); try { DelegateDefinitions dd = new DelegateDefinitions(); dd.ReferenceParameterReferenceDelegate = new ReferenceParameterReferenceDelegate(dd.TestReferenceParameterReferenceCallbackWithNullValue); dd.ReferenceParameterReferenceDelegate(null); } catch (Exception e) { TestLibrary.TestFramework.LogError("049", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return retVal; }
public bool PosTest5() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("PosTest5: Return type is reference type, with a reference parameter"); try { DelegateDefinitions dd = new DelegateDefinitions(); dd.ReferenceParameterReferenceDelegate = new ReferenceParameterReferenceDelegate(dd.TestReferenceParameterReferenceCallback); if (null == dd.ReferenceParameterReferenceDelegate) { TestLibrary.TestFramework.LogError("011", "Failed to assign a call back function to a delegate"); retVal = false; } object returnObject = dd.ReferenceParameterReferenceDelegate(DelegateDefinitions.c_DELEGATE_TEST_DEFAUTL_REFERENCE_PARAMETER); if ( !returnObject.Equals(DelegateDefinitions.c_DELEGATE_TEST_DEFAUTL_REFERENCE_PARAMETER) ) { TestLibrary.TestFramework.LogError("012", "Incorrect delegate return value: " + returnObject); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("013", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return retVal; }