public void Parse(string text, string fileName = @"d:\projects\MyProject\test.ts") { ProjectContent = MockRepository.GenerateStub<IProjectContent>(); var textBuffer = new StringTextBuffer(text); var scriptLoader = new ParseTestScriptLoader(); var logger = new LanguageServiceLogger(); ITypeScriptContextFactory contextFactory = MockRepository.GenerateStub<ITypeScriptContextFactory>(); contextFactory .Stub(f => f.CreateContext()) .Return(new TypeScriptContext(scriptLoader, logger)); var parser = new TypeScriptParser(contextFactory); CompilationUnit = parser.Parse(ProjectContent, fileName, textBuffer); }
public void Parse(string text, string fileName = @"d:\projects\MyProject\test.ts") { Project = MockRepository.GenerateStub<IProject>(); var fileContent = new TextDocument(text); var scriptLoader = new ParseTestScriptLoader(); var logger = new LanguageServiceLogger(); ITypeScriptContextFactory contextFactory = MockRepository.GenerateStub<ITypeScriptContextFactory>(); contextFactory .Stub(f => f.CreateContext()) .Return(new TypeScriptContext(javaScriptContext, scriptLoader, logger)); var parser = new TypeScriptParser(contextFactory); ParseInfo = parser.Parse(new FileName(fileName), fileContent, null, new TypeScriptFile[0]); }