From 1de81ff1daaf02f3fe5cc66402b5ed60999a8e36 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 10 Mar 2017 20:35:32 +0100 Subject: [PATCH] [corlib][Mono.Posix] Remove NunitHelpers.cs reference --- .../Mono.Posix/Mono.Posix_test.dll.sources | 1 - .../Mono.Posix/Test/Mono.Unix/ReadlinkTest.cs | 8 +-- .../Test/System.Reflection/VisibilityTest.cs | 59 +++++++++++-------- mcs/class/corlib/corlib_test.dll.sources | 1 - 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/mcs/class/Mono.Posix/Mono.Posix_test.dll.sources b/mcs/class/Mono.Posix/Mono.Posix_test.dll.sources index 55773333f78..a2f290f8656 100644 --- a/mcs/class/Mono.Posix/Mono.Posix_test.dll.sources +++ b/mcs/class/Mono.Posix/Mono.Posix_test.dll.sources @@ -1,4 +1,3 @@ -../../test-helpers/NunitHelpers.cs Mono.Unix/ReadlinkTest.cs Mono.Unix/StdioFileStreamTest.cs Mono.Unix/UnixEncodingTest.cs diff --git a/mcs/class/Mono.Posix/Test/Mono.Unix/ReadlinkTest.cs b/mcs/class/Mono.Posix/Test/Mono.Unix/ReadlinkTest.cs index 2f286d49b81..2d22a29c910 100644 --- a/mcs/class/Mono.Posix/Test/Mono.Unix/ReadlinkTest.cs +++ b/mcs/class/Mono.Posix/Test/Mono.Unix/ReadlinkTest.cs @@ -173,7 +173,7 @@ namespace MonoTests.Mono.Unix long r = Syscall.readlink (link, buf); if (r < 0) UnixMarshal.ThrowExceptionForLastError (); - AssertHelper.GreaterOrEqual (buf.Length, r); + Assert.That(buf.Length, Is.GreaterThanOrEqualTo(r)); if (r == buf.Length) buf = new byte[checked (buf.Length * 2)]; else @@ -199,7 +199,7 @@ namespace MonoTests.Mono.Unix long r = Syscall.readlinkat (TempFD, "link", buf); if (r < 0) UnixMarshal.ThrowExceptionForLastError (); - AssertHelper.GreaterOrEqual (buf.Length, r); + Assert.That(buf.Length, Is.GreaterThanOrEqualTo(r)); if (r == buf.Length) buf = new byte[checked (buf.Length * 2)]; else @@ -226,7 +226,7 @@ namespace MonoTests.Mono.Unix if (r < 0) UnixMarshal.ThrowExceptionForLastError (); Assert.AreEqual (r, sb.Length); - AssertHelper.GreaterOrEqual (sb.Capacity, r); + Assert.That(sb.Capacity, Is.GreaterThanOrEqualTo(r)); if (r == sb.Capacity) checked { sb.Capacity *= 2; } else @@ -255,7 +255,7 @@ namespace MonoTests.Mono.Unix if (r < 0) UnixMarshal.ThrowExceptionForLastError (); Assert.AreEqual (r, sb.Length); - AssertHelper.GreaterOrEqual (sb.Capacity, r); + Assert.That(sb.Capacity, Is.GreaterThanOrEqualTo(r)); if (r == sb.Capacity) checked { sb.Capacity *= 2; } else diff --git a/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs b/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs index 0a869918be8..ab540f65e67 100644 --- a/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs +++ b/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs @@ -30,30 +30,41 @@ using System; using System.Linq; using System.Reflection; using NUnit.Framework; +using System.Collections; namespace MonoTests.System.Reflection.VisibilityTypes { [TestFixture] public class VisibilityTests { + static void DoesNotContain (IEnumerable collection, object val) + { + Assert.That(collection, Has.No.Member(val)); + } + + static void Contains (IEnumerable collection, object val) + { + Assert.That(collection, Has.Member(val)); + } + [Test] public void TestsExportedTypes () { var types = typeof (VisibilityTests).Assembly.GetExportedTypes (); // Test visibility means that the class is public by applying and on the 'public' visibility of the nested items. - CollectionAssert.DoesNotContain (types, typeof (InternalClass)); - CollectionAssert.Contains (types, typeof (PublicClass)); - - CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true)); - CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true)); - CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true)); - CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true)); - - CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true)); - CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true)); - CollectionAssert.DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true)); - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true)); + DoesNotContain (types, typeof (InternalClass)); + Contains (types, typeof (PublicClass)); + + DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true)); + DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true)); + DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true)); + DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true)); + + DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true)); + DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true)); + DoesNotContain (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true)); + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true)); } [Test] @@ -62,18 +73,18 @@ namespace MonoTests.System.Reflection.VisibilityTypes var types = typeof (VisibilityTests).Module.GetTypes (); // Test that all the types defined exist. - CollectionAssert.Contains (types, typeof (InternalClass)); - CollectionAssert.Contains (types, typeof (PublicClass)); - - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true)); - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true)); - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true)); - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true)); - - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true)); - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true)); - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true)); - CollectionAssert.Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true)); + Contains (types, typeof (InternalClass)); + Contains (types, typeof (PublicClass)); + + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+InternalNested", true)); + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PrivateNested", true)); + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+ProtectedNested", true)); + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+InternalClass+PublicNested", true)); + + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+InternalNested", true)); + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PrivateNested", true)); + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+ProtectedNested", true)); + Contains (types, Type.GetType ("MonoTests.System.Reflection.VisibilityTypes.VisibilityTests+PublicClass+PublicNested", true)); } class InternalClass diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources index 4e444a37efa..bc43d92b920 100644 --- a/mcs/class/corlib/corlib_test.dll.sources +++ b/mcs/class/corlib/corlib_test.dll.sources @@ -1,4 +1,3 @@ -../../test-helpers/NunitHelpers.cs Microsoft.Win32/RegistryKeyTest.cs Mono/DataConvertTest.cs ../Mono/DataConverter.cs -- 2.25.1