public void InsertParagraph_WithCorrectArgs_ShouldInsertParagraphToDocument() { var command = "insertParagraph 0 text1\ninsertParagraph end text2\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = ""; Assert.AreEqual(expected, sw.ToString()); }
public void SetTitle_WithCorrectArgs_ShouldSetTitleToDocument() { var command = "setTitle title\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = ""; Assert.AreEqual(expected, sw.ToString()); }
public void SetTitle_WithInvalidArgsCount_ShouldPrintMessage() { var command = "setTitle\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = "Not enough arguments! Usage: setTitle <title>\r\n"; Assert.AreEqual(expected, sw.ToString()); }
public void DeleteItem_WithCorrectArgs_ShouldDeleteItemFromDocument() { var command = "insertParagraph 0 text\ndelete 0\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = ""; Assert.AreEqual(expected, sw.ToString()); }
public void ReplaceText_WithCorrectArgs_ShouldReplaceTextInParagraph() { var command = "insertParagraph 0 text1\nreplace 0 text2\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = ""; Assert.AreEqual(expected, sw.ToString()); }
public void Redo_ShouldRedoUndoCommand() { var command = "setTitle title\nundo\nredo\nlist"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = "Title: title\r\n"; Assert.AreEqual(expected, sw.ToString()); }
public void Exit_ShouldStopProgrammRunning() { var command = "setTitle title\nlist\nexit"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = "Title: title\r\n"; Assert.AreEqual(expected, sw.ToString()); }
public void ShowList_ShouldPrintAllDocumentElements() { var command = "setTitle title\ninsertParagraph 0 first\ninsertParagraph end last\nlist"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = "Title: title\r\n0. Paragraph: first\r\n1. Paragraph: last\r\n"; Assert.AreEqual(expected, sw.ToString()); }
public void DeleteItem_WithInvalidArgsCount_ShouldPrintMessage() { var command = "delete\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = "Not enough arguments! Usage: delete <position>\r\n"; Assert.AreEqual(expected, sw.ToString()); }
public void ReplaceText_WithInvalidArgsCount_ShouldPrintMessage() { var command = "insertParagraph 0 text1\nreplace 0\nreplace\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = "Not enough arguments! Usage: replace <position>|end <text>\r\n" + "Not enough arguments! Usage: replace <position>|end <text>\r\n"; Assert.AreEqual(expected, sw.ToString()); }
public void Save_WithCorrectArgs_ShouldSaveSocumentToPath() { string path = Directory.GetCurrentDirectory() + "\\index.html"; var command = $"save {path}"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = ""; Assert.AreEqual(expected, sw.ToString()); Assert.IsTrue(File.Exists(path)); File.Delete(path); }
public static void Main() { StaticData.StaticLists.Init(); StaticData.RelationshipGroups.Init(); MainEditor = new Editor.Editor(); MissionPlayer = new MissionPlayer(); Game.FrameRender += FrameRender; for (;;) { Process(); GameFiber.Yield(); } }
public MainWindow(Editor.Editor parent) { m_parent = parent; InitializeComponent(); // Callbacks added here since the designer enjoys making life miserable this.MainPictureBox.MouseEnter += new System.EventHandler(this.MainPictureBox_MouseEnter); this.BottomBarGfxCombo.SelectedIndexChanged += new System.EventHandler(this.BottomBarGfxCombo_SelectedIndexChanged); this.RightPanelTabControl.Selected += new System.Windows.Forms.TabControlEventHandler(this.RightPanelTabControl_Selected); this.PartTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.PartTreeView_AfterSelect); this.BrushesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.BrushesTreeView_AfterSelect); }
public void ShowInstructions_ShouldShowHelpInfo() { var command = "help\n"; var sr = new StringReader(command); var sw = new StringWriter(); Editor.Editor editor = new Editor.Editor(sw, sr); editor.Start(); var expected = "Commands list:\r\n" + " insertParagraph: Insert paragraph <position>|end <text>\r\n" + " setTitle: Set title of document <title>\r\n" + " list: Show document as list\r\n" + " replace: Replace text in paragraph <position> <text>\r\n" + " delete: Delete item <position>\r\n" + " help: Show help\r\n" + " exit: Exit programm\r\n" + " undo: Undo command\r\n" + " redo: Redo command\r\n" + " save: Save document to html <path>\r\n"; Assert.AreEqual(expected, sw.ToString()); }
public static void PostStart(Editor.Editor editor) { if (File.Exists(MapFile) && Game != null) { var map = MapProvider.GetMapFromFile(MapFile); DocumentManager.AddAndSwitch(new Document(MapFile, map, Game)); } // Texture panel //using (var tlp = new TextureListPanel()) //{ // tlp.ImageSize = 128; // tlp.Dock = DockStyle.Fill; // tlp.AddTextures(TexturePackage.GetLoadedItems()); // using (var dialog = new Form()) // { // dialog.Controls.Add(tlp); // dialog.ShowDialog(); // } //} // Texture tool editor.SelectTool(ToolManager.Tools[0]); }
private SaberFactoryMenuButton(SiraLog logger, Editor.Editor editor) { _logger = logger; _editor = editor; _menuButton = new MenuButton("Saber Factory", "Good quality sabers", OnClick); }
protected SaberFactoryMenuButton(Editor.Editor editor) : base("Saber Factory", "Good quality sabers") { _editor = editor; }
public DirPopup(Editor.Editor parent) { m_parent = parent; InitializeComponent(); }