diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases.Expectations')
2 files changed, 46 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RecognizedReflectionAccessPatternAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RecognizedReflectionAccessPatternAttribute.cs new file mode 100644 index 000000000..09d83aa65 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/RecognizedReflectionAccessPatternAttribute.cs @@ -0,0 +1,24 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = false)] + public class RecognizedReflectionAccessPatternAttribute : BaseExpectedLinkedBehaviorAttribute + { + public RecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, Type[] reflectionMethodParameters, + Type accessedItemType, string accessedItemName, Type[] accessedItemParameters) + { + if (reflectionMethodType == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (reflectionMethodType)); + if (reflectionMethodName == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (reflectionMethodName)); + if (reflectionMethodParameters == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (reflectionMethodParameters)); + + if (accessedItemType == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (accessedItemType)); + if (accessedItemName == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (accessedItemName)); + } + } +} diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs new file mode 100644 index 000000000..666c2da63 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases.Expectations/Assertions/UnrecognizedReflectionAccessPatternAttribute.cs @@ -0,0 +1,22 @@ +using System; + +namespace Mono.Linker.Tests.Cases.Expectations.Assertions +{ + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = false)] + public class UnrecognizedReflectionAccessPatternAttribute : BaseExpectedLinkedBehaviorAttribute + { + public UnrecognizedReflectionAccessPatternAttribute (Type reflectionMethodType, string reflectionMethodName, Type [] reflectionMethodParameters, + string message = null) + { + if (reflectionMethodType == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (reflectionMethodType)); + if (reflectionMethodName == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (reflectionMethodName)); + if (reflectionMethodParameters == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (reflectionMethodParameters)); + + if (message == null) + throw new ArgumentException ("Value cannot be null or empty.", nameof (message)); + } + } +} |