CodeGeneratorTestBase.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // Microsoft.VisualBasic.* Test Cases
  3. //
  4. // Authors:
  5. // Jochen Wezel ([email protected])
  6. //
  7. // Based on the C# units of
  8. // Erik LeBel ([email protected])
  9. //
  10. // (c) 2003 Jochen Wezel, CompuMaster GmbH
  11. //
  12. using System;
  13. using System.IO;
  14. using System.Text;
  15. using System.CodeDom;
  16. using System.CodeDom.Compiler;
  17. using Microsoft.VisualBasic;
  18. using NUnit.Framework;
  19. namespace MonoTests.Microsoft.VisualBasic
  20. {
  21. ///
  22. /// <summary>
  23. /// Base test for a variety of CodeGenerator GenerateCodeXXX methods.
  24. ///
  25. /// This testing is a form of hybrid test, it tests the variety of CodeDom
  26. /// classes as well as the VB code generator.
  27. ///
  28. /// The implementations bellow provide a template as well as guidlines for
  29. /// implementing further tests.
  30. /// </summary>
  31. ///
  32. public abstract class CodeGeneratorTestBase
  33. {
  34. CodeDomProvider provider = null;
  35. protected ICodeGenerator generator = null;
  36. protected CodeGeneratorOptions options = null;
  37. protected StringWriter writer = null;
  38. public void InitBase()
  39. {
  40. provider = new VBCodeProvider ();
  41. generator = provider.CreateGenerator ();
  42. options = new CodeGeneratorOptions ();
  43. writer = new StringWriter ();
  44. writer.NewLine = "\n";
  45. }
  46. protected virtual string Code {
  47. get { return writer.ToString (); }
  48. }
  49. protected abstract void Generate ();
  50. }
  51. }