From bb42df4e9922fdddf05bae453b16b6a3dd6942b6 Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Sat, 13 Apr 2019 21:57:06 -0400 Subject: [PATCH] Add Assembly.LoadWithPartialName cases (dotnet/corefx#36803) * Add Assembly.LoadWithPartialName cases Cover hole reported in dotnet/coreclrdotnet/corefx#19817 * Verify argument parameter name * Disable new test on .NetFramework Commit migrated from https://github.com/dotnet/corefx/commit/5ae3c5655cd84bf3c7f9568477153642fdd7c95e --- src/libraries/System.Reflection/tests/AssemblyTests.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libraries/System.Reflection/tests/AssemblyTests.cs b/src/libraries/System.Reflection/tests/AssemblyTests.cs index f394ca5..f06eea9 100644 --- a/src/libraries/System.Reflection/tests/AssemblyTests.cs +++ b/src/libraries/System.Reflection/tests/AssemblyTests.cs @@ -465,6 +465,16 @@ namespace System.Reflection.Tests string simpleName = typeof(AssemblyTests).Assembly.GetName().Name; var assembly = Assembly.LoadWithPartialName(simpleName); Assert.Equal(typeof(AssemblyTests).Assembly, assembly); + } + + [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.UapAot, "Assembly.LoadFromWithPartialName() not supported on UapAot")] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] + public void LoadWithPartialName_Neg() + { + AssertExtensions.Throws("partialName", () => Assembly.LoadWithPartialName(null)); + AssertExtensions.Throws("partialName", () => Assembly.LoadWithPartialName("")); + Assert.Null(Assembly.LoadWithPartialName("no such assembly")); } #pragma warning restore 618 @@ -680,6 +690,8 @@ namespace System.Reflection.Tests string emptyCName = new string('\0', 1); AssertExtensions.Throws(null, () => Assembly.Load(emptyCName)); + + Assert.Throws(() => Assembly.Load("no such assembly")); // No such assembly } [Fact] -- 2.7.4