CodeGeneratorTestBase.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. public void InitBase()
  38. {
  39. provider = new VBCodeProvider ();
  40. generator = provider.CreateGenerator ();
  41. options = new CodeGeneratorOptions ();
  42. }
  43. protected string Generate ()
  44. {
  45. return Generate (options);
  46. }
  47. protected virtual string NewLine
  48. {
  49. get { return "\n"; }
  50. }
  51. protected abstract string Generate (CodeGeneratorOptions options);
  52. }
  53. }