public void ProcessRequest(HttpContext context)
 {
     var localPath = context.Request.Url.LocalPath;
     if (string.IsNullOrEmpty(localPath)) return;
     var reader = new VirtualPathFileReader();
     var fileContents = reader.ReadFile(localPath);
     var writer = new TypeScriptWriter();
     var engine = writer.GetEngine();
     var output = writer.CompileTypeScript(engine, fileContents);
     context.Response.ContentType = "text/javascript";
     context.Response.Write(output);
 }
        public void Can_Get_Successfull_Result()
        {
            var compiler = new TypeScriptWriter();
            var engine = compiler.GetEngine();

            var test = @"function greeter(person: string) {
                            return ""Hello, "" + person;
                        }
                        var user = ""Jane User"";
                        document.body.innerHTML = greeter(user);";

            var result = compiler.CompileTypeScript(engine, test);
            Assert.IsFalse(TypeScriptCompilationErrorParser.HasErrors(result));            
        }
        public void ProcessRequest(HttpContext context)
        {
            var localPath = context.Request.Url.LocalPath;

            if (string.IsNullOrEmpty(localPath))
            {
                return;
            }
            var reader       = new VirtualPathFileReader();
            var fileContents = reader.ReadFile(localPath);
            var writer       = new TypeScriptWriter();
            var engine       = writer.GetEngine();
            var output       = writer.CompileTypeScript(engine, fileContents);

            context.Response.ContentType = "text/javascript";
            context.Response.Write(output);
        }
 public void Can_Create_Engine()
 {
     var compiler = new TypeScriptWriter();
     var engine = compiler.GetEngine();
     Assert.NotNull(engine);
 }
        public void Can_Get_Exception_Result()
        {
            var compiler = new TypeScriptWriter();
            var engine = compiler.GetEngine();

            var test = @"functio greeter(person: stringz) {
                                        return ""Hello, "" +=-+ person;
                                    
                                    var user = ""Jane User"";
                                    document.body.innerHTML = greeter(user);";


            Assert.Throws<TypeScriptCompilationException>(() => compiler.CompileTypeScript(engine, test));            
        }