From a83470f96018a6fafbaf7969466da6178a9e0b84 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 21 May 2019 21:26:13 -0700 Subject: [PATCH] Regression test for multiple attributes on the same type (dotnet/corefx#37518) Contributes to dotnet/corefx#37261 Commit migrated from https://github.com/dotnet/corefx/commit/85d82a0402e26fb02be4c006752904cb8e0f8b02 --- src/libraries/System.Runtime/tests/System/Attributes.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libraries/System.Runtime/tests/System/Attributes.cs b/src/libraries/System.Runtime/tests/System/Attributes.cs index 035429c..4fb34d9 100644 --- a/src/libraries/System.Runtime/tests/System/Attributes.cs +++ b/src/libraries/System.Runtime/tests/System/Attributes.cs @@ -199,6 +199,13 @@ namespace System.Tests Assert.Throws(() => Attribute.GetCustomAttributes(typeof(TestClass2).GetMethod("TestMethod2"), null, false)); Assert.Throws(() => Attribute.GetCustomAttributes(typeof(TestClass2).GetMethod("TestMethod2").GetParameters()[0], null, false)); } + + [Fact] + public static void MultipleAttributesTest() + { + Assert.Equal("System.Tests.MyCustomAttribute System.Tests.MyCustomAttribute", string.Join(" ", typeof(MultipleAttributes).GetCustomAttributes(inherit: false))); + Assert.Equal("System.Tests.MyCustomAttribute System.Tests.MyCustomAttribute", string.Join(" ", typeof(MultipleAttributes).GetCustomAttributes(inherit: true))); + } } public static class GetCustomAttribute { @@ -786,4 +793,10 @@ namespace System.Tests set { } } } + + [MyCustomAttribute("Test")] + [MyCustomAttribute("Test")] + class MultipleAttributes + { + } } -- 2.7.4