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 DisambiguateComaSetUp() { 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); }
public void Setup() { var pluginMain = Substitute.For <ASCompletion.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>(); Sci = GetBaseScintillaControl(); doc.SciControl.Returns(Sci); }
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 GenerateJobSetup() { 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>(); sci = GetBaseScintillaControl(); doc.SciControl.Returns(sci); }
public void DisambiguateComaSetUp() { 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); }
public void ContextualActionsSetup() { 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>(); }