コード例 #1
0
        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);
        }
コード例 #2
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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public void TestCompilerNotNull()
        {
            WebSharpCompiler compiler = new WebSharpCompiler();

            Assert.IsNotNull(compiler.Compile(""));
        }