ParameterInfoTest.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // ParameterInfoTest - NUnit Test Cases for the ParameterInfo class
  3. //
  4. // Zoltan Varga ([email protected])
  5. //
  6. // (C) Ximian, Inc. http://www.ximian.com
  7. //
  8. //
  9. using System;
  10. using System.Threading;
  11. using System.Reflection;
  12. using System.Reflection.Emit;
  13. using System.Runtime.InteropServices;
  14. using NUnit.Framework;
  15. namespace MonoTests.System.Reflection
  16. {
  17. [TestFixture]
  18. public class ParameterInfoTest : Assertion
  19. {
  20. public static void paramMethod (int i, [In] int j, [Out] int k, [Optional] int l, [In,Out] int m) {
  21. }
  22. #if NET_2_0
  23. [Test]
  24. public void PseudoCustomAttributes () {
  25. ParameterInfo[] info = typeof (ParameterInfoTest).GetMethod ("paramMethod").GetParameters ();
  26. AssertEquals (0, info[0].GetCustomAttributes (true).Length);
  27. AssertEquals (1, info[1].GetCustomAttributes (typeof (InAttribute), true).Length);
  28. AssertEquals (1, info[2].GetCustomAttributes (typeof (OutAttribute), true).Length);
  29. AssertEquals (1, info[3].GetCustomAttributes (typeof (OptionalAttribute), true).Length);
  30. AssertEquals (2, info[4].GetCustomAttributes (true).Length);
  31. }
  32. #endif
  33. }
  34. }