public void TestCompilerFiveErrors() { WebSharpCompilerBusiness.WebSharpCompiler compiler = new WebSharpCompilerBusiness.WebSharpCompiler(); string programText = @" using **** System; namespace HelloWorld { clas HelloWorldClass { static void Main(string[] args) { Console.ReadLine(); } }"; List <string> compilerErrors = compiler.Compile(programText); Assert.AreEqual(compilerErrors.Count, 5); }
protected void btnCompile_Click(object sender, EventArgs e) { lstCompilerOutput.Items.Clear(); WebSharpCompilerBusiness.WebSharpCompiler compiler = new WebSharpCompilerBusiness.WebSharpCompiler(); List <string> compilerErrors = compiler.Compile(txtCode.Text); //if (String.IsNullOrEmpty(txtCode.Text)) //{ // lstCompilerOutput.Items.Add("program text cannot be null or empty"); //} if (compilerErrors.Count == 0) { lstCompilerOutput.Items.Add("No Errors"); } foreach (string error in compilerErrors) { lstCompilerOutput.Items.Add(error); Console.WriteLine(); } }
public void TestCompilerNotNull() { WebSharpCompilerBusiness.WebSharpCompiler compiler = new WebSharpCompilerBusiness.WebSharpCompiler(); Assert.IsNotNull(compiler.Compile("")); }