public void TestCompilerSuccessfulCompilation() { WebSharpCompiler compiler = new WebSharpCompiler(); string programText = @" using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace CodeCompile { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } public int myFunc() { string a; return a; } } }"; List <string> compilerErrors = compiler.CompileError((programText)); Assert.AreEqual(compilerErrors.Count, 0); }
public void TestCompilerFiveErrors() { WebSharpCompiler compiler = new WebSharpCompiler(); // REVIEW MATT : Updated to be more readable. string programText = @" using **** System; namesp8ce HelloWorld { clas HelloWorldClass { static void Main(string[] args) { Console.ReadLine(); } }"; List <string> compilerErrors = compiler.Compile(programText); Assert.AreEqual(compilerErrors.Count, 5); }
public void TestCompilerSingleError() { WebSharpCompiler compiler = new WebSharpCompiler(); string programText = @" using **** System; namespace HelloWorld { class HelloWorldClass { static void Main(string[] args) { Console.ReadLine(); } } }"; List <string> compilerErrors = compiler.Compile(programText); Assert.AreEqual(compilerErrors.Count, 1); }
public void TestCompilerNotNull() { WebSharpCompiler compiler = new WebSharpCompiler(); Assert.IsNotNull(compiler.Compile("")); }