CompileCode() public method

public CompileCode ( string code ) : CompilerResults
code string
return System.CodeDom.Compiler.CompilerResults
コード例 #1
0
ファイル: InvalidCodeTests.cs プロジェクト: mjedrzejek/nunit
 public void CodeShouldNotCompile(string fragment)
 {
     string code = template1.Replace("$FRAGMENT$", fragment);
     TestCompiler compiler = new TestCompiler(
         new string[] { "system.dll", "nunit.framework.dll" },
         "test.dll");
     CompilerResults results = compiler.CompileCode(code);
     if (results.NativeCompilerReturnValue == 0)
         Assert.Fail("Code fragment \"" + fragment + "\" should not compile but it did");
 }
コード例 #2
0
        public void CodeShouldNotCompileAsFinishedConstraint(string fragment)
        {
            string       code     = template2.Replace("$FRAGMENT$", fragment);
            TestCompiler compiler = new TestCompiler(
                new string[] { "system.dll", "nunit.framework.dll" },
                "test.dll");
            CompilerResults results = compiler.CompileCode(code);

            if (results.NativeCompilerReturnValue == 0)
            {
                Assert.Fail("Code fragment \"" + fragment + "\" should not compile as a finished constraint but it did");
            }
        }