Esempio n. 1
0
        public async Task TestToggle_Visible_StartOfLine()
        {
            //We need to create full document and not just editor
            //so extensions are initialized which set custom C#
            //tagger based syntax highligthing
            const string input = @"class Foo
{
	void Bar ()
$	{
		//test
	}
}";

            using (var testCase = await SetupTestCase("", wrap: true)) {
                var editor = testCase.Document.Editor;
                SetupInput(editor, input);

                //Call UpdateParseDocument so AdHock Roslyn Workspace is created for file
                await testCase.Document.DocumentContext.UpdateParseDocument();

                //Finnaly call command Update so it sets values which we assert
                var info = new Components.Commands.CommandInfo();
                testCase.GetContent <DefaultCommandTextEditorExtension> ().OnUpdateToggleComment(info);
                Assert.AreEqual(true, info.Visible);
                Assert.AreEqual(true, info.Enabled);
            }
        }
Esempio n. 2
0
        public async Task TestToggle_Visible()
        {
            IdeApp.Initialize(new Core.ProgressMonitor());
            //This dummyEditor is just so we can reuse CreateTextEditor code
            //to resolve offset for us
            var dummyEditor = CreateTextEditor(@"class Foo
{
	void Bar ()
	{
		//$test
	}
}");
            //We need to create full document and not just editor
            //so extensions are initialized which set custom C#
            //tagger based syntax highligthing
            var document = IdeApp.Workbench.NewDocument("a.cs", "text/x-csharp", dummyEditor.Text);

            document.Editor.CaretOffset = dummyEditor.CaretOffset;
            //Call UpdateParseDocument so AdHock Roslyn Workspace is created for file
            await document.UpdateParseDocument();

            var info = new Components.Commands.CommandInfo();

            //Finnaly call command Update so it sets values which we assert
            GetExtension(document.Editor).OnUpdateToggleComment(info);
            await document.Close();

            Assert.AreEqual(true, info.Visible);
            Assert.AreEqual(true, info.Enabled);
        }
Esempio n. 3
0
 public void ShowPreviousUpdateHandler(Components.Commands.CommandInfo info)
 {
     if (!Visible)
     {
         info.Bypass = true;
     }
     else
     {
         info.Text = GettextCatalog.GetString("Show Previous (Difference)");
     }
 }