PropertyInfoTest.cs 764 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // PropertyInfoTest.cs - NUnit Test Cases for PropertyInfo
  3. //
  4. // Author:
  5. // Gert Driesen ([email protected])
  6. //
  7. // (C) 2004 Novell
  8. //
  9. using System;
  10. using System.Reflection;
  11. using NUnit.Framework;
  12. namespace MonoTests.System.Reflection
  13. {
  14. [TestFixture]
  15. public class PropertyInfoTest : Assertion
  16. {
  17. [Test]
  18. public void GetAccessorsTest()
  19. {
  20. Type type = typeof(TestClass);
  21. PropertyInfo property = type.GetProperty ("ReadOnlyProperty");
  22. MethodInfo[] methods = property.GetAccessors (true);
  23. AssertEquals ("GetAccessors#1", 1, methods.Length);
  24. AssertNotNull ("GetAccessors#2", methods[0]);
  25. }
  26. private class TestClass
  27. {
  28. public string ReadOnlyProperty
  29. {
  30. get { return string.Empty; }
  31. }
  32. }
  33. }
  34. }