From 72c86fe6cc214bd8dcd2043846c90a6cc5cbe58d Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 6 Oct 2017 13:56:14 +0200 Subject: [PATCH] [corlib] Makes GetReferencedAssemblies test more reliable --- .../Test/System.Reflection/AssemblyTest.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs b/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs index b3a9ba80127..1fcbf8a410b 100644 --- a/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs +++ b/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs @@ -502,20 +502,17 @@ namespace MonoTests.System.Reflection public void GetReferencedAssemblies () { Assembly corlib_test = Assembly.GetExecutingAssembly (); - AssemblyName[] names = corlib_test.GetReferencedAssemblies (); - foreach (AssemblyName an in names) { - Assert.IsNull (an.CodeBase, "CodeBase"); - Assert.IsNotNull (an.CultureInfo, "CultureInfo"); - Assert.IsNull (an.EscapedCodeBase, "EscapedCodeBase"); - Assert.AreEqual (AssemblyNameFlags.None, an.Flags, "Flags"); - Assert.IsNotNull (an.FullName, "FullName"); - Assert.AreEqual (AssemblyHashAlgorithm.SHA1, an.HashAlgorithm, "HashAlgorithm"); - Assert.IsNull (an.KeyPair, "KeyPair"); - Assert.IsNotNull (an.Name, "Name"); - Assert.IsNotNull (an.Version, "Version"); - Assert.AreEqual (AssemblyVersionCompatibility.SameMachine, - an.VersionCompatibility, "VersionCompatibility"); - } + AssemblyName an = corlib_test.GetReferencedAssemblies ().First (l => l.Name == "mscorlib"); + Assert.IsNull (an.CodeBase, "CodeBase"); + Assert.IsNotNull (an.CultureInfo, "CultureInfo"); + Assert.IsNull (an.EscapedCodeBase, "EscapedCodeBase"); + Assert.AreEqual (AssemblyNameFlags.None, an.Flags, "Flags"); + Assert.IsNotNull (an.FullName, "FullName"); + Assert.AreEqual (AssemblyHashAlgorithm.SHA1, an.HashAlgorithm, "HashAlgorithm"); + Assert.IsNull (an.KeyPair, "KeyPair"); + Assert.IsNotNull (an.Name, "Name"); + Assert.IsNotNull (an.Version, "Version"); + Assert.AreEqual (AssemblyVersionCompatibility.SameMachine, an.VersionCompatibility, "VersionCompatibility"); } #if !MONOTOUCH && !FULL_AOT_RUNTIME // Reflection.Emit is not supported. -- 2.25.1