private static void TestMethod_SLPStr_InOutRef() { TestFramework.BeginScenario("StdCall,LPStr,InOutRef"); try { StringBuilder sb = GetInvalidString(); string rstr = SLPStr_InOutByRef(ref sb); //Check the return value string sTemp = (GetInvalidString()).ToString(); if (!Compare(sTemp, rstr)) { Fails++; TestFramework.LogError("025", "TestMethod_SLPStr_InOutRef:The Return value is wrong."); } //Check the Parameter if (!Compare(sTemp, sb.ToString())) { Fails++; TestFramework.LogError("026", "TestMethod_SLPStr_InOutRef:The Parameter value is wrong."); } } catch (Exception e) { Fails++; TestFramework.LogError("e13", "TestMethod_SLPStr_InOutRef:Unexpected Exception Occurred:" + e.ToString()); } }
private static void TestMethod_SLPStr_DelegatePInvoke() { TestFramework.BeginScenario("StdCall,LPStr,DelegatePInvoke"); try { DelegatePInvoke_StdCall caller = SLPStr_DelegatePInvoke(); StringBuilder sb = GetInvalidString(); string rstr = caller(ref sb); //Check the return value string sTemp = (GetInvalidString()).ToString(); if (!Compare(sTemp, rstr)) { Fails++; TestFramework.LogError("027", "TestMethod_SLPStr_DelegatePInvoke:The Return value is wrong."); } //Check the Parameter if (!Compare(sTemp, sb.ToString())) { Fails++; TestFramework.LogError("028", "TestMethod_SLPStr_DelegatePInvoke:The Parameter value is wrong."); } } catch (Exception e) { Fails++; TestFramework.LogError("e14", "TestMethod_SLPStr_DelegatePInvoke:Unexpected Exception Occurred:" + e.ToString()); } }
private static void TestMethod_SLPStr_Out() { TestFramework.BeginScenario("StdCall,LPStr,Out"); try { StringBuilder sb = new StringBuilder(); string rstr = SLPStr_Out(sb); string NativeString = "AAAA"; //check the return value if (!NativeString.Equals(rstr)) { Fails++; TestFramework.LogError("017", "TestMethod_SLPStr_Out:The Return value is wrong."); } //Check the Parameter if (!NativeString.Equals(sb.ToString())) { Fails++; TestFramework.LogError("018", "TestMethod_SLPStr_Out:The Parameter value is wrong."); } } catch (Exception e) { Fails++; TestFramework.LogError("e09", "TestMethod_SLPStr_Out:Unexpected Exception Occurred:" + e.ToString()); } }
private static void TestMethod_SLPStr_OutRef() { TestFramework.BeginScenario("StdCall,LPStr,OutRef"); try { StringBuilder sb = new StringBuilder(10); string rstr = SLPStr_OutByRef(out sb); //Check the return value string sNative = "AAAA"; if (!sNative.Equals(rstr)) { Fails++; TestFramework.LogError("023", "TestMethod_CLPStr_OutRef:The Return value is wrong."); } //Check the Parameter if (!sNative.Equals(sb.ToString())) { Fails++; Console.WriteLine(sb.ToString()); TestFramework.LogError("024", "TestMethod_CLPStr_OutRef:The Parameter value is wrong."); } } catch (Exception e) { Fails++; TestFramework.LogError("e12", "TestMethod_SLPStr_OutRef:Unexpected Exception Occurred:" + e.ToString()); } }
private static bool TestMethod_CallBackInOut(int size, bool[] array) { bool retVal = true; //Check the Input if (SIZE != size) { retVal = false; TestFramework.LogError("005", "Failed on the Managed Side:TestMethod_CallBackInOut:Parameter Size is wrong"); } for (int i = 0; i < SIZE; ++i) //Reverse PInvoke, true,false,true false,true { if ((0 == i % 2) && !array[i]) { retVal = false; TestFramework.LogError("006", "Failed on the Managed Side:TestMethod_CallBackInOut. The " + (i + 1) + "st Item failed"); } else if ((1 == i % 2) && array[i]) { retVal = false; TestFramework.LogError("007", "Failed on the Managed Side:TestMethod_CallBackInOut. The " + (i + 1) + "st Item failed"); } } //Check the output for (int i = 0; i < size; ++i) //Reverse PInvoke, true,true,true true,true { array[i] = true; } return(retVal); }
//Stdcall private static void TestMethod_SLPStr_In() { TestFramework.BeginScenario("StdCall,LPStr,In"); try { StringBuilder sb = GetInvalidString(); string rstr = SLPStr_In(sb.ToString()); //Check the return value and the parameter. StringBuilder sbTemp = GetInvalidString(); if (!Compare(sbTemp.ToString(), rstr)) { Fails++; TestFramework.LogError("015", "TestMethod_SLPStr_In:The Return value is wrong."); } if (!sb.Equals(sbTemp)) { Fails++; TestFramework.LogError("016", "TestMethod_SLPStr_In:The Parameter value is wrong."); } } catch (Exception e) { Fails++; TestFramework.LogError("e08", "TestMethod_SLPStr_In:Unexpected Exception Occurred:" + e.ToString()); } }
public bool PosTest2() { bool retVal = true; TestFramework.BeginScenario("Test IsAlive with long WeakReference"); try { WeakReference extWR = new WeakReference(WRHelper.CreateAnObject("Test"), true); if (!extWR.IsAlive) { TestFramework.LogError("004", "WeakReference IsAlive not as expected. Expected : True; Actual: " + extWR.IsAlive); retVal = false; } GC.Collect(); GC.WaitForPendingFinalizers(); if (!extWR.IsAlive) { TestFramework.LogError("005", "WeakReference IsAlive not as expected. Expected : True; Actual: " + extWR.IsAlive); retVal = false; } } catch (Exception e) { TestFramework.LogError("006", "Unexpected exception occured: " + e); retVal = false; } return(retVal); }
public bool PosTest1() { bool ret = true; TestLibrary.TestFramework.BeginScenario("Creating the shift_jis encoding"); try { Encoding enc2 = Encoding.GetEncoding("shift_jis"); if (enc2.WebName != "shift_jis") { ret = false; TestFramework.LogError("002", "Error creating encoding. Web name not as expected. Expected: shift_jis Actual: " + enc2.WebName); } Encoding enc3 = Encoding.GetEncoding("sHiFT_JIs"); if (enc3.WebName != "shift_jis") { ret = false; TestFramework.LogError("003", "Error creating encoding. Web name not as expected. Expected: shift_jis Actual: " + enc3.WebName); } } catch (Exception exc) { ret = false; TestFramework.LogError("004", "Unexpected error: " + exc.ToString()); } return(ret); }
public bool Test2() { string id = "Scenario2"; bool result = true; TestFramework.BeginScenario("Scenario 2: Setting capacity to current capacity"); try { StringBuilder sb = new StringBuilder("Test", 4); sb.Capacity = 4; string output = sb.ToString(); int cap = sb.Capacity; if (output != "Test") { result = false; TestFramework.LogError("004", "Error in " + id + ", unexpected string. Actual string " + output + ", Expected: Test"); } if (cap != 4) { result = false; TestFramework.LogError("005", "Error in " + id + ", unexpected capacity. Actual capacity " + cap + ", Expected: 4"); } } catch (Exception exc) { result = false; TestFramework.LogError("006", "Unexpected exception in " + id + ", exception: " + exc.ToString()); } return(result); }
// ATTENTION!!! ATTENTION!!! ATTENTION!!! // // If you encounter issues with object lifetime, please see more comments in WeakReferenceCtor2.cs public bool PosTest1() { bool retVal = true; TestFramework.BeginScenario("Test IsAlive with short WeakReference"); try { WeakReference extWR = new WeakReference(WRHelper.CreateAnObject("Test"), false); if (!extWR.IsAlive) { TestFramework.LogError("001", "WeakReference IsAlive not as expected. Expected : True; Actual: " + extWR.IsAlive); retVal = false; } GC.Collect(); GC.WaitForPendingFinalizers(); //Dev10 Bug #413556: WeakReference object incorrectly kept alive. Enable after the test is fixed. // //if (extWR.IsAlive) //{ // TestFramework.LogError("002", "WeakReference IsAlive not as expected. Expected : False; Actual: " + extWR.IsAlive); // retVal = false; //} } catch (Exception e) { TestFramework.LogError("003", "Unexpected exception occured: " + e); retVal = false; } return(retVal); }
public bool Test1() { string id = "Scenario1"; bool result = true; TestFramework.BeginScenario("Scenario 1: Setting Capacity to 0"); try { StringBuilder sb = new StringBuilder("Test"); sb.Capacity = 0; string output = sb.ToString(); int cap = sb.Capacity; result = false; TestFramework.LogError("001", "Error in " + id + ", expected exception not thrown. Capacity: " + cap + ", string: " + output); } catch (Exception exc) { if (exc.GetType() != typeof(ArgumentOutOfRangeException)) { result = false; TestFramework.LogError("003", "Unexpected exception in " + id + ", expected type: " + typeof(ArgumentOutOfRangeException).ToString() + ", Actual exception: " + exc.ToString()); } } return(result); }
public bool Test5() { string id = "Scenario5"; bool result = true; TestFramework.BeginScenario("Scenario 5: Setting capacity to something very large"); try { StringBuilder sb = new StringBuilder("Test"); sb.Capacity = 10004; string output = sb.ToString(); int capacity = sb.Capacity; if (output != "Test") { result = false; TestFramework.LogError("013", "Error in " + id + ", unexpected string. Actual string " + output + ", Expected: Test"); } if (capacity != 10004) { result = false; TestFramework.LogError("014", "Error in " + id + ", unexpected legnth. Actual capacity " + capacity + ", Expected: 10004"); } } catch (Exception exc) { result = false; TestFramework.LogError("015", "Unexpected exception in " + id + ", exception: " + exc.ToString()); } return(result); }
public bool Test3() { string id = "Scenario3"; bool result = true; TestFramework.BeginScenario("Scenario 3: Setting capacity to > length < capacity"); try { StringBuilder sb = new StringBuilder("Test", 10); sb.Capacity = 8; string output = sb.ToString(); int capacity = sb.Capacity; if (output != "Test") { result = false; TestFramework.LogError("007", "Error in " + id + ", unexpected string. Actual string " + output + ", Expected: Test"); } if (capacity != 8) { result = false; TestFramework.LogError("008", "Error in " + id + ", unexpected legnth. Actual capacity" + capacity + ", Expected: 8"); } } catch (Exception exc) { result = false; TestFramework.LogError("009", "Unexpected exception in " + id + ", exception: " + exc.ToString()); } return(result); }
//TestMethod2,Pinvoke,StdCall static bool TestMethod_PInvoke_StdCall() { TestFramework.BeginScenario("Pinvoke,StdCall"); bool bresult = true; try { char[] pCharArray = new char[LEN]; for (int i = 0; i < LEN; i++) { pCharArray[i] = (char)('a' + i); } if (!MarshalRefCharArray_Stdcall(ref pCharArray)) { bresult = false; TestFramework.LogError("003", "MarshalRefCharArray_Stdcall:The Input(From Managed To Native) is wrong"); } if ('z' != pCharArray[0]) { bresult = false; TestFramework.LogError("004", "MarshalRefCharArray_Stdcall:The value hasnt changed"); } } catch (Exception e) { bresult = false; TestFramework.LogError("e02", "Unexpected Exception" + e.ToString()); } return(bresult); }
private static void TestMethod_CLPStr_In() { TestFramework.BeginScenario("Cdecl,LPStr,In"); try { StringBuilder sb = GetInvalidString(); string str = sb.ToString(); string rstr = CLPStr_In(str); //Check the return value and the parameter. StringBuilder sbTemp = GetInvalidString(); if (!Compare(str, rstr)) { Fails++; TestFramework.LogError("001", "TestMethod_CLPStr_In"); } if (!sb.Equals(sbTemp)) { Fails++; TestFramework.LogError("002", "TestMethod_CLPStr_In"); } } catch (Exception e) { Fails++; TestFramework.LogError("e01", "TestMethod_CLPStr_In:Unexpected Exception Occurred:" + e.ToString()); } }
public bool NegTest1() { bool ret = true; TestLibrary.TestFramework.BeginScenario("Creating the shift_jis encoding"); try { Encoding enc = Encoding.GetEncoding("shift_jis"); ret = false; TestFramework.LogError("00F", "Encoding created unexpectedly. Expected argument exception. Actual: Create encoding with name: " + enc.WebName); } catch (NotSupportedException) { // Expected } catch (ArgumentException) { // Expected } catch (Exception exc) { ret = false; TestFramework.LogError("010", "Unexpected error: " + exc.ToString()); } return(ret); }
private static void TestMethod_CLPStr_InRef() { TestFramework.BeginScenario("Cdecl,LPStr,InRef"); try { StringBuilder sb = GetInvalidString(); string rstr = CLPStr_InByRef(ref sb); //Check the return value string sTemp = (GetInvalidString()).ToString(); if (!Compare(sTemp, rstr)) { Fails++; TestFramework.LogError("007", "TestMethod_CLPStr_InRef:The Return value is wrong."); } //Check the Parameter if (!sTemp.Equals(sb.ToString())) { Fails++; TestFramework.LogError("008", "TestMethod_CLPStr_InRef:The Parameter value is wrong."); } } catch (Exception e) { Fails++; TestFramework.LogError("e04", "TestMethod_CLPStr_InRef:Unexpected Exception Occurred:" + e.ToString()); } }
private static bool TestMethod_CallBackRefIn(int size, ref bool[] array) { bool retVal = true; //Check the Input if (SIZE != size) { retVal = false; TestFramework.LogError("008", "Failed on the Managed Side:TestMethod_CallBackRefIn:Parameter Size is wrong"); } //TODO: UnComment these line if the SizeConst attributes is support //Since now the sizeconst doesnt support on ref,so only check the first item instead. //Unhandled Exception: System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'parameter #2': Cannot use SizeParamIndex for ByRef array parameters. //for (int i = 0; i < size; ++i) //Reverse PInvoke, true,false,true false,true //{ // if ((0 == i % 2) && !array[i]) // { // ReportFailure("Failed on the Managed Side:TestMethod_CallBackRefIn. The " + (i + 1) + "st Item failed", true.ToString(), false.ToString()); // } // else if ((1 == i % 2) && array[i]) // { // ReportFailure("Failed on the Managed Side:TestMethod_CallBackRefIn. The " + (i + 1) + "st Item failed", false.ToString(), true.ToString()); // } // } if (!array[0]) { retVal = false; TestFramework.LogError("009", "Failed on the Managed Side:TestMethod_CallBackRefIn. The first Item failed"); } return(retVal); }
public bool PosTest4() { bool ret = true; TestLibrary.TestFramework.BeginScenario("Decoding byte[]s with the shift_jis encoding"); try { Encoding enc = Encoding.GetEncoding("shift_jis"); byte[] bytes = { 0x87, 0x90 }; char[] expected = new char[] { '\x2252' }; char[] actual = enc.GetChars(bytes); if (!Utilities.CompareChars(actual, expected)) { ret = false; TestFramework.LogError("00D", "Decoding byte[] -> char[] not as expected! Expected: 0x8786 Actual "); foreach (char c in actual) { Logging.Write("0x" + ((int)c).ToString("x") + " "); } } } catch (Exception exc) { ret = false; TestFramework.LogError("00E", "Unexpected error: " + exc.ToString()); } return(ret); }
private static bool TestMethod_DelegatePInvokeStdcall() { TestFramework.BeginScenario("DelegatePinvoke,Cdecl"); bool bresult = true; try { char[] p = new char[LEN]; for (int i = 0; i < LEN; i++) { p[i] = (char)('a' + i); } DelegatePInvokeStdcall caller = DelegatePinvoke_Stdcall(); if (!caller(ref p)) { bresult = false; TestFramework.LogError("009", "TestMethod_DelegatePInvokeStdcall:The return value is wrong"); } if ('z' != p[0]) { bresult = false; TestFramework.LogError("010", "TestMethod_DelegatePInvokeStdcall:The value hasnt changed"); } } catch (Exception e) { bresult = false; TestFramework.LogError("e06", "Unexpected Exception" + e.ToString()); } return(bresult); }
public bool Test7() { string id = "Scenario7"; bool result = true; TestFramework.BeginScenario("Scenario 7: Setting Length to < 0 capacity"); try { StringBuilder sb = new StringBuilder(4, 10); sb.Append("Test"); sb.Length = -1; string output = sb.ToString(); result = false; TestFramework.LogError("018", "Error in " + id + ", Expected exception not thrown. No exception. Actual string " + output + ", Expected: " + typeof(ArgumentOutOfRangeException).ToString()); } catch (Exception exc) { if (exc.GetType() != typeof(ArgumentOutOfRangeException)) { result = false; TestFramework.LogError("018", "Unexpected exception in " + id + ", expected type: " + typeof(ArgumentOutOfRangeException).ToString() + ", Actual excpetion: " + exc.ToString()); } } return(result); }
public bool Test5() { string id = "Scenario5"; bool result = true; TestFramework.BeginScenario("Scenario 5: Setting Length to something very large"); try { StringBuilder sb = new StringBuilder("Test"); sb.Length = 10004; string output = sb.ToString(); int length = sb.Length; if (output != ("Test" + new string('\0', 10000))) { result = false; TestFramework.LogError("013", "Error in " + id + ", unexpected string. Actual string " + output + ", Expected: Test"); } if (length != 10004) { result = false; TestFramework.LogError("014", "Error in " + id + ", unexpected legnth. Actual length " + length + ", Expected: 10004"); } } catch (Exception exc) { result = false; TestFramework.LogError("015", "Unexpected exception in " + id + ", excpetion: " + exc.ToString()); } return(result); }
public bool Test4() { string id = "Scenario4"; bool result = true; TestFramework.BeginScenario("Scenario 4: Setting Length to > capacity"); try { StringBuilder sb = new StringBuilder("Test", 10); sb.Length = 12; string output = sb.ToString(); int length = sb.Length; if (output != "Test\0\0\0\0\0\0\0\0") { result = false; TestFramework.LogError("010", "Error in " + id + ", unexpected string. Actual string " + output + ", Expected: Test\0\0\0\0\0\0\0\0"); } if (length != 12) { result = false; TestFramework.LogError("011", "Error in " + id + ", unexpected legnth. Actual length " + length + ", Expected: 12"); } } catch (Exception exc) { result = false; TestFramework.LogError("012", "Unexpected exception in " + id + ", excpetion: " + exc.ToString()); } return(result); }
private static int TestMethod_ReversePInvoke_Cdecl(CdeFunc func) { if (-1 != func()) { TestFramework.LogError("01", "The Return Value(TestMethod_ReversePInvoke_Cdecl) is wrong"); } return(678); }
public static bool PosTest1() { string s = "before"; string changedValue = "after"; bool retval = true; Sstr p = new Sstr(0, false, s); TestFramework.BeginScenario("Test #1 (Roundtrip of a simple structre by reference. Verify that values updated on unmanaged side reflect on managed side)"); //Direct pinvoke //cdecl calling convention. try { TestFramework.LogInformation(" Case 2: Direct p/invoke cdecl calling convention"); retval = DoCdeclSimpleStructByRef(ref p); if ((p.a != 100) || (!p.b) || (!p.str.Equals(changedValue))) { Console.WriteLine("\nExpected values:\n SimpleStruct->a=" + 100 + "\nSimpleStruct->b=TRUE\n" + "SimpleStruct->str=after\n"); Console.WriteLine("\nActual values:\n SimpleStruct->a=" + p.a + "\nSimpleStruct->b=" + p.b + "\nSimpleStruct->str=" + p.str + "\n"); TestFramework.LogError("03", "PInvokeTests->PosTest1 : Returned values are different from expected values"); retval = false; } } catch (Exception e) { TestFramework.LogError("04", "Unexpected exception: " + e.ToString()); retval = false; } //Delegate pinvoke //cdecl try { TestFramework.LogInformation(" Case 4: Delegate p/invoke - cdecl calling convention"); CdeclSimpleStructByRefDelegate std = GetFptrCdeclSimpleStructByRef(14); retval = std(ref p); if ((p.a != 100) || (!p.b) || (!p.str.Equals(changedValue))) { Console.WriteLine("\nExpected values:\n SimpleStruct->a=" + 100 + "\nSimpleStruct->b=TRUE\n" + "SimpleStruct->str=after\n"); Console.WriteLine("\nActual values:\n SimpleStruct->a=" + p.a + "\nSimpleStruct->b=" + p.b + "\nSimpleStruct->str=" + p.str + "\n"); TestFramework.LogError("01", "PInvokeTests->PosTest1 : Returned values are different from expected values"); retval = false; } } catch (Exception e) { TestFramework.LogError("02", "Unexpected exception: " + e.ToString()); retval = false; } return(retval); }
static int Main(string[] args) { // Disable running on Windows 7 until IJW activation work is complete. if (Environment.OSVersion.Platform != PlatformID.Win32NT || TestLibrary.Utilities.IsWindows7) { return(100); } bool success = true; // Load a fake mscoree.dll to avoid starting desktop LoadLibraryEx(Path.Combine(Environment.CurrentDirectory, "mscoree.dll"), IntPtr.Zero, 0); TestFramework.BeginScenario("Calling from managed to native IJW code"); // Building with a reference to the IJW dll is difficult, so load via reflection instead TestFramework.BeginTestCase("Load IJW dll via reflection"); Assembly ijwNativeDll = Assembly.Load("IjwNativeDll"); TestFramework.EndTestCase(); TestFramework.BeginTestCase("Call native method returning int"); Type testType = ijwNativeDll.GetType("TestClass"); object testInstance = Activator.CreateInstance(testType); MethodInfo testMethod = testType.GetMethod("ManagedEntryPoint"); int result = (int)testMethod.Invoke(testInstance, null); if (result != 100) { TestFramework.LogError("IJW", "Incorrect result returned: " + result); success = false; } TestFramework.EndTestCase(); TestFramework.BeginTestCase("Negative: Load IJW dll as byte array"); byte[] ijwBytes = File.ReadAllBytes("IjwNativeDll.dll"); try { Assembly.Load(ijwBytes); TestFramework.LogError("IJW", "Loading IJW dll as byte array should have thrown"); success = false; } catch { } TestFramework.EndTestCase(); TestFramework.BeginTestCase("Ensure .NET Framework was not loaded"); IntPtr clrHandle = GetModuleHandle("mscoreei.dll"); if (clrHandle != IntPtr.Zero) { TestFramework.LogError("IJW", ".NET Framework loaded by IJw module load"); success = false; } TestFramework.EndTestCase(); return(success ? 100 : 99); }
static int Main() { bool retVal = true; //TestFramework.BeginScenario("Reverse PInvoke with In attribute"); if (!DoCallBackIn(new CallBackIn(TestMethod_CallBackIn))) { retVal = false; //TestFramework.LogError("013","Error happens in Native side:DoCallBackIn"); } //TestFramework.BeginScenario("Reverse PInvoke with Out attribute"); if (!DoCallBackOut(new CallBackOut(TestMethod_CallBackOut))) { retVal = false; //TestFramework.LogError("014","Error happens in Native side:DoCallBackOut"); } // TestFramework.BeginScenario("Reverse PInvoke with InOut attribute"); if (!DoCallBackInOut(new CallBackInOut(TestMethod_CallBackInOut))) { retVal = false; TestFramework.LogError("015", "Error happens in Native side:DoCallBackInOut"); } // TestFramework.BeginScenario("Reverse PInvoke Reference In"); if (!DoCallBackRefIn(new CallBackRefIn(TestMethod_CallBackRefIn))) { retVal = false; //TestFramework.LogError("016","Error happens in Native side:DoCallBackRefIn"); } // TestFramework.BeginScenario("Reverse PInvoke Reference Out"); if (!DoCallBackRefOut(new CallBackRefOut(TestMethod_CallBackRefOut))) { retVal = false; //TestFramework.LogError("017","Error happens in Native side:DoCallBackRefOut"); } //TestFramework.BeginScenario("Reverse PInvoke Reference InOut"); if (!DoCallBackRefInOut(new CallBackRefInOut(TestMethod_CallBackRefInOut))) { retVal = false; //TestFramework.LogError("019","Error happens in Native side:DoCallBackRefInOut"); } if (retVal) { //Console.WriteLine("Succeeded!"); return(100); } throw new Exception("Failed"); // return 101; }
bool VerifyProcessorCount() { SYSTEM_INFO sysInfo = new SYSTEM_INFO(); SYSTEM_INFO.GetSystemInfo(ref sysInfo); if (Environment.ProcessorCount != sysInfo.dwNumberOfProcessors) { TestFramework.LogError("001", @"ProcessorCount not as expected. Expected (from Win32): " + sysInfo.dwNumberOfProcessors.ToString() + ", Actual (from CLR): " + Environment.ProcessorCount.ToString()); return(false); } return(true); }
static int Main() { bool breturn = true; TestFramework.BeginScenario("ReversePInvoke Cdecl"); if (!DoCallBack_Cdecl(new Cdeclcaller(TestMethod_ReversePInvoke_Cdecl))) { breturn = false; TestFramework.LogError("04", "The Return value(DoCallBack_Cdecl) is wrong"); } return(breturn ? 100: 101); }
public static string TestMethod_CCallBackInByRef(ref string str) { //Check Input string sNative = "AAAA"; if (sNative != str) { Fails++;//Use Fails variable since the parameters and the return value are used by scenario TestFramework.LogError("031", "TestMethod_CCallBackInByRef:The Input value is wrong"); } StringBuilder sb = GetInvalidString(); return(sb.ToString()); }