From ac312b6772386236f2a275447a7ab8614b681929 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 2 Mar 2018 19:47:07 -0800 Subject: [PATCH] Add tests for TypeForwardedFromAttribute (#27599) Fixes #27554 --- .../tests/System.Runtime.Tests.csproj | 1 + .../CompilerServices/AttributesTests.cs | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/System.Runtime/tests/System/Runtime/CompilerServices/AttributesTests.cs diff --git a/src/System.Runtime/tests/System.Runtime.Tests.csproj b/src/System.Runtime/tests/System.Runtime.Tests.csproj index 6304ccd13245..4ee705af93a9 100644 --- a/src/System.Runtime/tests/System.Runtime.Tests.csproj +++ b/src/System.Runtime/tests/System.Runtime.Tests.csproj @@ -165,6 +165,7 @@ + diff --git a/src/System.Runtime/tests/System/Runtime/CompilerServices/AttributesTests.cs b/src/System.Runtime/tests/System/Runtime/CompilerServices/AttributesTests.cs new file mode 100644 index 000000000000..876b4d367cbc --- /dev/null +++ b/src/System.Runtime/tests/System/Runtime/CompilerServices/AttributesTests.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Xunit; + +namespace System.Runtime.CompilerServices.Tests +{ + public static class AttributesTests + { + [Fact] + public static void TypeForwardedToAttributeTests() + { + string assemblyFullName = "MyAssembly"; + var attr = new TypeForwardedFromAttribute(assemblyFullName); + Assert.Equal(assemblyFullName, attr.AssemblyFullName); + + AssertExtensions.Throws("assemblyFullName", () => new TypeForwardedFromAttribute(null)); + AssertExtensions.Throws("assemblyFullName", () => new TypeForwardedFromAttribute("")); + } + } +}