public void RuntimeErrorTest()
        {
            var host = new RazorFolderHostContainer();

            host.TemplatePath     = Path.GetFullPath(@"..\..\FileTemplates\");
            host.BaseBinaryFolder = Environment.CurrentDirectory;

            // add model assembly - ie. this assembly
            host.AddAssemblyFromType(typeof(Person));
            host.UseAppDomain = false;

            // these are implicitly set
            host.Configuration.CompileToMemory = false;
            //host.Configuration.TempAssemblyPath = Environment.CurrentDirectory;

            host.Start();

            Person person = new Person()
            {
                Name    = "Rick",
                Company = "West Wind",
                Entered = DateTime.Now,
                Address = new Address()
                {
                    Street = "32 Kaiea",
                    City   = "Paia"
                }
            };
            string result = host.RenderTemplate("~/RuntimeError.cshtml", person);

            Assert.IsNull(result, "result should be null on error");
            Console.WriteLine(host.ErrorMessage);  // simple message

            Assert.IsNotNull(host.LastException, "Last exception should be set");

            Console.WriteLine("---");
            Console.WriteLine(host.LastException.Message);
            Console.WriteLine(host.LastException.ActiveTemplate);
            //Console.WriteLine(host.LastException.GeneratedSourceCode);
            Console.WriteLine("---");

            // Render HTML output of the error with source code and line numbers for errors
            Console.WriteLine(host.RenderHtmlErrorPage());

            host.Stop();

            Assert.IsNull(result);
            Assert.IsTrue(!string.IsNullOrEmpty(host.ErrorMessage));
        }
        public void BasicFolderWithRoslynCompilerTest()
        {
            var host = new RazorFolderHostContainer();

            host.CodeProvider = new Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider();

            host.TemplatePath     = Path.GetFullPath(@"..\..\FileTemplates\");
            host.BaseBinaryFolder = Environment.CurrentDirectory;

            // add model assembly - ie. this assembly
            host.AddAssemblyFromType(typeof(Person));
            host.UseAppDomain = false;

            // these are implicitly set
            //host.Configuration.CompileToMemory = true;
            //host.Configuration.TempAssemblyPath = Environment.CurrentDirectory;

            host.Start();

            Person person = new Person()
            {
                Name    = "Rick",
                Company = "West Wind",
                Entered = DateTime.Now,
                Address = new Address()
                {
                    Street = "32 Kaiea",
                    City   = "Paia"
                }
            };

            string result = host.RenderTemplate("~/SubFolder/HelloWorldCSharpLatest.cshtml", person);



            Console.WriteLine(result);
            Console.WriteLine("---");
            Console.WriteLine(host.RenderHtmlErrorPage());

            host.Stop();

            if (result == null)
            {
                Assert.Fail(host.ErrorMessage);
            }

            Assert.IsTrue(result.Contains("West Wind"));
        }