AssemblyTest.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // System.Reflection.Assembly Test Cases
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. // Philippe Lavoie ([email protected])
  7. //
  8. // (c) 2003 Ximian, Inc. (http://www.ximian.com)
  9. //
  10. using NUnit.Framework;
  11. using System;
  12. using System.Reflection;
  13. namespace MonoTests.System.Reflection
  14. {
  15. [TestFixture]
  16. public class AssemblyTest : Assertion
  17. {
  18. [Test]
  19. public void CreateInstance()
  20. {
  21. Type type = typeof (AssemblyTest);
  22. Object obj = type.Assembly.CreateInstance ("MonoTests.System.Reflection.AssemblyTest");
  23. AssertNotNull ("#01", obj);
  24. AssertEquals ("#02", GetType(), obj.GetType());
  25. }
  26. [Test]
  27. public void CreateInvalidInstance()
  28. {
  29. Type type = typeof (AssemblyTest);
  30. Object obj = type.Assembly.CreateInstance("NunitTests.ThisTypeDoesNotExist");
  31. AssertNull ("#03", obj);
  32. }
  33. [Test]
  34. [ExpectedException (typeof (TypeLoadException))]
  35. public void TestGetType () {
  36. // Bug #49114
  37. typeof (int).Assembly.GetType ("&blabla", true, true);
  38. }
  39. }
  40. }