diff options
Diffstat (limited to 'src/System.Reflection/tests/Common.cs')
-rw-r--r-- | src/System.Reflection/tests/Common.cs | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/System.Reflection/tests/Common.cs b/src/System.Reflection/tests/Common.cs new file mode 100644 index 0000000000..e4a35db85b --- /dev/null +++ b/src/System.Reflection/tests/Common.cs @@ -0,0 +1,109 @@ +// 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. + +namespace System.Reflection.Tests +{ + public enum PublicEnum + { + Case1 = 1, + Case2 = 2, + Case3 = 3 + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class Attr : Attribute + { + public Attr(int i) + { + value = i; + } + + public override string ToString() => $"{value}, {name}"; + + public string name; + public int value; + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class Int32Attr : Attribute + { + public Int32Attr(int i) + { + value = i; + } + + public string name; + public readonly int value; + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class Int64Attr : Attribute + { + public Int64Attr(long l) + { + value = l; + } + + public string name; + public readonly long value; + + public override string ToString() => $"{value}, {name}"; + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class EnumAttr : Attribute + { + public EnumAttr(PublicEnum e) + { + value = e; + } + + public string name; + public readonly PublicEnum value; + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class StringAttr : Attribute + { + public StringAttr(string s) + { + value = s; + } + + public string name; + public readonly string value; + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class TypeAttr : Attribute + { + public TypeAttr(Type t) + { + value = t; + } + + public string name; + public readonly Type value; + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class ObjectAttr : Attribute + { + public ObjectAttr(object v) + { + value = v; + } + + public string name; + public readonly object value; + } + + [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] + public class NullAttr : Attribute { } + + public class Helpers + { + public static Assembly ExecutingAssembly => typeof(Helpers).GetTypeInfo().Assembly; + } +} |