Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,59 @@
//
// Base class for CodeGenerator unit tests
//
// Authors:
// Gert Driesen (drieseng@users.sourceforge.net)
//
// (c) Novell
//
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.IO;
using NUnit.Framework;
namespace MonoTests.System.CodeDom.Compiler
{
public abstract class CodeGeneratorTestBase
{
private CodeGeneratorOptions _options;
[SetUp]
public virtual void SetUp ()
{
_options = new CodeGeneratorOptions ();
}
protected abstract ICodeGenerator CodeGenerator
{
get;
}
protected virtual string NewLine
{
get { return "\n"; }
}
protected CodeGeneratorOptions Options
{
get { return _options; }
}
protected string GenerateCodeFromType (CodeTypeDeclaration type)
{
return GenerateCodeFromType (type, _options);
}
protected virtual string GenerateCodeFromType (CodeTypeDeclaration type, CodeGeneratorOptions options)
{
using (StringWriter writer = new StringWriter ()) {
writer.NewLine = NewLine;
CodeGenerator.GenerateCodeFromType (type, writer, options);
writer.Close ();
return writer.ToString ();
}
}
}
}