public void ParseBlockCanParse1000NestedElements() { var content = Nested1000.ReadAllText(); // Assert - does not throw ParseDocument(content); }
public void CheckForStructureChangesStartsReparseAndFiresDocumentParseCompletedEventIfNoAdditionalChangesQueued() { // Arrange using (RazorEditorParser parser = CreateClientParser()) { StringTextBuffer input = new StringTextBuffer(SimpleCSHTMLDocument.ReadAllText()); DocumentParseCompleteEventArgs capturedArgs = null; ManualResetEventSlim parseComplete = new ManualResetEventSlim(false); parser.DocumentParseComplete += (sender, args) => { capturedArgs = args; parseComplete.Set(); }; // Act parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(String.Empty), input.Length, input)); // Assert MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait); string generatedCode = capturedArgs.GeneratorResults.GeneratedCode.GenerateCode <CSharpCodeProvider>(); Assert.Equal( SimpleCSHTMLDocumentGenerated.ReadAllText(), MiscUtils.StripRuntimeVersion(generatedCode)); } }
public void SimpleTest() { //TODO: Improve this test with more checks! var pluginMain = Substitute.For <PluginMain>(); var pluginUiMock = new PluginUIMock(pluginMain); pluginMain.MenuItems.Returns(new List <System.Windows.Forms.ToolStripItem>()); pluginMain.Settings.Returns(new GeneralSettings()); pluginMain.Panel.Returns(pluginUiMock); ASContext.GlobalInit(pluginMain); ASContext.Context = Substitute.For <IASContext>(); ASContext.Context.CurrentLine = 9; var asContext = new AS3Context.Context(new AS3Settings()); ASContext.Context.Features.Returns(asContext.Features); ASContext.Context.GetCodeModel(null).ReturnsForAnyArgs(x => asContext.GetCodeModel(x.ArgAt <string>(0))); // Maybe we want to get the filemodel from ASFileParser even if we won't get a controlled environment? var member = new MemberModel("test1", "void", FlagType.Function, Visibility.Public) { LineFrom = 4, LineTo = 10, Parameters = new List <MemberModel> { new MemberModel("arg1", "String", FlagType.ParameterVar, Visibility.Default), new MemberModel("arg2", "Boolean", FlagType.ParameterVar, Visibility.Default) { Value = "false" } } }; var classModel = new ClassModel(); classModel.Name = "ASCompleteTest"; classModel.Members.Add(member); var fileModel = new FileModel(); fileModel.Classes.Add(classModel); classModel.InFile = fileModel; ASContext.Context.CurrentModel.Returns(fileModel); ASContext.Context.CurrentClass.Returns(classModel); ASContext.Context.CurrentMember.Returns(member); var sci = GetBaseScintillaControl(); sci.Text = TestFile.ReadAllText("ASCompletion.Test_Files.completion.as3.SimpleTest.as"); sci.ConfigurationLanguage = "as3"; sci.Colourise(0, -1); var result = ASComplete.GetExpressionType(sci, 185); Assert.True(result.Context != null && result.Context.LocalVars != null); Assert.AreEqual(4, result.Context.LocalVars.Count); }
public void ParseBlockCanParse1000NestedElements() { var content = Nested1000.ReadAllText(); ParseDocument(content); }
public void ParseBlockCanParse1000NestedElements() { string content = Nested1000.ReadAllText(); SingleSpanDocumentTest(content, BlockType.Markup, SpanKind.Markup); }
internal new static string ReadAllTextHaxe(string fileName) => TestFile.ReadAllText($"{nameof(HaXeContext)}.Test_Files.completion.generated.{fileName}.hx");
protected static string ReadAllText(string fileName) => TestFile.ReadAllText(GetFullPath(fileName));
protected static string ReadAllTextHaxe(string fileName) => TestFile.ReadAllText($"{nameof(CodeRefactor)}.Test_Files.coderefactor.organizeimports.haxe.{fileName}.hx");
internal static string ReadAllTextHaxe(string fileName) => TestFile.ReadAllText($"{nameof(CodeRefactor)}.Test_Files.coderefactor.extractlocalvariable.haxe.{fileName}.hx");
protected static string ReadAllText(string fileName) => TestFile.ReadAllText($"{nameof(HaXeContext)}.Test_Files.coderefactor.organizeimports.{fileName}.hx");
internal static string ReadAllText(string fileName) => TestFile.ReadAllText(GetFullPath(fileName));
internal static string ReadAllTextHaxe(string fileName) { return(TestFile.ReadAllText($"{nameof(ForForeachConverter)}.Test_Files.completion.haxe.{fileName}")); }
static string ReadAllTextAS3(string fileName) => TestFile.ReadAllText(GetFullPathAS3(fileName));