예제 #1
0
        private static string CompileIntegrationTestCases()
        {
            var modelSource = CodeExamples.DieselCompilerIntegrationTestCase;
            var sourceCode  = DieselCompiler.Compile(modelSource);

            return(sourceCode);
        }
        private static CompilerResults Compile(string dieselSource)
        {
            var csharpSource   = DieselCompiler.Compile(dieselSource);
            var csharpCompiler = DieselCompiler.GetCSharpProvider();
            var parameters     = new CompilerParameters()
            {
                GenerateExecutable      = false,
                GenerateInMemory        = true,
                IncludeDebugInformation = false,
                ReferencedAssemblies    = { "System.Runtime.Serialization.dll" }
            };
            var result = csharpCompiler.CompileAssemblyFromSource(parameters, csharpSource);

            Assert.That(result.Errors, Is.Empty);
            return(result);
        }
예제 #3
0
        public void Compile_InvalidModelSource_ShouldFail()
        {
            const string modelSource = "(namespace Foo (defvaluetype SpuriousParen)) (";

            Assert.Throws <Sprache.ParseException>(() => DieselCompiler.Compile(modelSource));
        }