2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / System / Test / Microsoft.VisualBasic / CodeGeneratorTestBase.cs
1 //
2 // Microsoft.VisualBasic.* Test Cases
3 //
4 // Authors:
5 //      Jochen Wezel (jwezel@compumaster.de)
6 //
7 // Based on the C# units of
8 //      Erik LeBel (eriklebel@yahoo.ca)
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
19 using NUnit.Framework;
20
21 namespace MonoTests.Microsoft.VisualBasic
22 {
23         ///
24         /// <summary>
25         ///     Base test for a variety of CodeGenerator GenerateCodeXXX methods.
26         ///
27         ///     This testing is a form of hybrid test, it tests the variety of CodeDom
28         ///     classes as well as the VB code generator.
29         ///
30         ///     The implementations bellow provide a template as well as guidlines for
31         ///     implementing further tests.
32         /// </summary>
33         ///
34         public abstract class CodeGeneratorTestBase
35         {
36                 CodeDomProvider provider = null;
37                 protected ICodeGenerator generator = null;
38                 protected CodeGeneratorOptions options = null;
39                 protected StringWriter writer = null;
40         
41                 public void InitBase()
42                 {
43                         provider = new VBCodeProvider ();
44                         generator = provider.CreateGenerator ();
45                         options = new CodeGeneratorOptions ();
46                         writer = new StringWriter ();
47
48                         writer.NewLine = "\n";
49                 }
50
51                 protected virtual string Code {
52                         get { return writer.ToString (); }
53                 }
54
55                 protected abstract void Generate ();
56         }
57 }