public bool PosTest3() { bool retVal = true; int randValue = 0; TestLibrary.TestFramework.BeginScenario("PosTest3: call Dispose on valid SafeHandle instance with false"); try { MySafeValidHandle handle = new MySafeValidHandle(); handle.DisposeWrap(false); randValue = TestLibrary.Generator.GetInt32(-55); handle = new MySafeValidHandle(new IntPtr(randValue)); handle.DisposeWrap(false); } catch (Exception e) { TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation("WARNING: [LOCAL VARIABLES] randValue = " + randValue); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return(retVal); }
public bool NegTest4() { bool retVal = true; int randValue = 0; TestLibrary.TestFramework.BeginScenario("NegTest3: Call Dispose twice"); try { randValue = TestLibrary.Generator.GetInt32(-55); MySafeValidHandle handle = new MySafeValidHandle(new IntPtr(randValue)); handle.DisposeWrap(false); handle.DisposeWrap(false); } catch (Exception e) { TestLibrary.TestFramework.LogError("104", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation("WARNING: [LOCAL VARIABLES] randValue = " + randValue); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return(retVal); }
public bool NegTest4() { bool retVal = true; int randValue = 0; TestLibrary.TestFramework.BeginScenario("NegTest3: Call Dispose twice"); try { randValue = TestLibrary.Generator.GetInt32(-55); MySafeValidHandle handle = new MySafeValidHandle(new IntPtr(randValue)); handle.DisposeWrap(false); handle.DisposeWrap(false); } catch (Exception e) { TestLibrary.TestFramework.LogError("104", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation("WARNING: [LOCAL VARIABLES] randValue = " + randValue); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return retVal; }
public bool PosTest3() { bool retVal = true; int randValue = 0; TestLibrary.TestFramework.BeginScenario("PosTest3: call Dispose on valid SafeHandle instance with false"); try { MySafeValidHandle handle = new MySafeValidHandle(); handle.DisposeWrap(false); randValue = TestLibrary.Generator.GetInt32(-55); handle = new MySafeValidHandle(new IntPtr(randValue)); handle.DisposeWrap(false); } catch (Exception e) { TestLibrary.TestFramework.LogError("003", "Unexpected exception: " + e); TestLibrary.TestFramework.LogInformation("WARNING: [LOCAL VARIABLES] randValue = " + randValue); TestLibrary.TestFramework.LogInformation(e.StackTrace); retVal = false; } return retVal; }