public void TestMethod1() { //Arrange PACTTextEditor editor = new PACTTextEditor(); editor.TextHandler = new TextHandler(); string fileName = TestResources.GetTestResourcesFile("Pact1.pact"); editor.TextHandler.Text = System.IO.File.ReadAllText(fileName); ITextEditorToolBarItem v = (from x in ((ITextEditor)editor).Tools where x.ToolText == "Export to JSON" select x).SingleOrDefault(); //Act v.Execute(editor); //Assert //TODO: check output }
public void AddPluginToolbarTool(ITextEditorToolBarItem t) { Button tool = new Button(); tool.ToolTip = t.ToolTip; tool.Content = t.ToolText; tool.Tag = t; tool.Click += ToolBarItemClick; //To keep the tools before the search control we do remove and then add //DO NOT Delete // toolbar.Items.Remove(lblSearch); // toolbar.Items.Remove(txtSearch); // toolbar.Items.Remove(btnClearSearch); toolbar.Items.Remove(lblView); toolbar.Items.Remove(comboView); toolbar.Items.Add(tool); // toolbar.Items.Add(lblSearch); // toolbar.Items.Add(txtSearch); // toolbar.Items.Add(btnClearSearch); toolbar.Items.Add(lblView); toolbar.Items.Add(comboView); }
private void ToolBarItemClick(object sender, RoutedEventArgs e) { ITextEditorToolBarItem tool = (ITextEditorToolBarItem)((Button)sender).Tag; tool.Execute((ITextEditor)mTextEditor); }