Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1836 from ludovic-henry/referencesource-safehandl…

…e-tests

[corlib] Fix tests for System.Runtime.InteropServices.SafeHandle
commit 200f157461ee8f1d9154481d81b081263d18f783 2 parents 3753066 + bdf0af5
@vargaz vargaz authored
View
21 mcs/class/corlib/Test/System.Runtime.InteropServices/SafeHandleTest.cs
@@ -51,15 +51,28 @@ protected override void Dispose (bool manual)
base.Dispose (manual);
}
}
-
+
+ [Test]
+ public void SimpleDispose ()
+ {
+ FakeSafeHandle sf = new FakeSafeHandle ();
+ sf.Dispose ();
+ }
+
[Test]
- [ExpectedException (typeof (ObjectDisposedException))]
public void BadDispose1 ()
{
FakeSafeHandle sf = new FakeSafeHandle ();
sf.DangerousRelease ();
- sf.DangerousRelease ();
+
+ try {
+ sf.DangerousRelease ();
+ Assert.Fail ("#1");
+ } catch (ObjectDisposedException) {
+ }
+
+ GC.SuppressFinalize (sf);
}
[Test]
@@ -130,6 +143,8 @@ public void GoodDispose ()
Assert.IsTrue (sf.IsClosed, "closed");
//Handle value is not changed, so the value itself is still valid (not 0 or -1)
Assert.IsFalse (sf.IsInvalid, "invalid");
+
+ GC.SuppressFinalize (sf);
}
[Test]
Please sign in to comment.
Something went wrong with that request. Please try again.