public void NoteMapGlue_AssignNoteBBC() { bool result = true; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var persistence = new PersistenceManager(); var noteEditor = new NoteEditor(); var form = CreateForm(); form.Controls.Add(noteEditor); form.Shown += (sender, args) => { var tree = persistence.OpenTree(@"Resources\Websites.mm"); var sut = new NoteMapGlue(noteEditor, persistence); tree.Tree.RootNode.FirstChild.Selected = true; result = noteEditor.HTML != null && noteEditor.HTML.Contains("BBC"); form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(result); }
public NoteEditorCtrl(NoteEditor editor, PersistenceManager pManager, DialogManager dialogs) { this.noteGlue = new NoteMapGlue(editor, pManager); new ImageLocalSaver(editor, pManager); new ImageLocalProvider(pManager); new ImagePaster(editor, pManager); this.dialogs = dialogs; }
public void NoteMapGlue() { NoteMapGlue sut = null; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var persistence = new PersistenceManager(); var nodeEditor = new NoteEditor(); sut = new NoteMapGlue(nodeEditor, persistence); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsNotNull(sut); }
public void UpdateNodeFromEditor() { bool result = true; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var persistence = new PersistenceManager(); var noteEditor = new NoteEditor(); var form = CreateForm(); form.Controls.Add(noteEditor); form.Shown += (sender, args) => { var ptree1 = persistence.NewTree(); var c1 = new MapNode(ptree1.Tree.RootNode, "c1"); c1.Selected = true; var sut = new NoteMapGlue(noteEditor, persistence); c1.NoteText = "ABC"; noteEditor.HTML = "EFG"; noteEditor.Dirty = true; sut.UpdateNodeFromEditor(); result = c1.NoteText != null && c1.NoteText.Contains("EFG"); form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(result); }
public void NoteMapGlue_MultiSelection_ClearNoteEditor() { bool result = true; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var persistence = new PersistenceManager(); var noteEditor = new NoteEditor(); var form = CreateForm(); form.Controls.Add(noteEditor); form.Shown += (sender, args) => { var tree = persistence.NewTree(); var c1 = new MapNode(tree.Tree.RootNode, "c1"); c1.Selected = true; var sut = new NoteMapGlue(noteEditor, persistence); c1.NoteText = "ABC"; tree.Tree.SelectedNodes.Add(c1.Parent); result = noteEditor.HTML == null; form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(result); }
public void NoteMapGlue_AssignNoteBBC_NavigatingEventFires() { int count = 0; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var persistence = new PersistenceManager(); var noteEditor = new NoteEditor(); noteEditor.Navigating += (o, e) => count++; var form = CreateForm(); form.Controls.Add(noteEditor); form.Shown += (sender, args) => { var tree = persistence.OpenTree(@"Resources\Websites.mm"); var sut = new NoteMapGlue(noteEditor, persistence); tree.Tree.RootNode.FirstChild.Selected = true; form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(count > 7); }
public void UpdateNodeFromEditor_WithSettingDirty() { bool result = true; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var persistence = new PersistenceManager(); var noteEditor = new NoteEditor(); var form = CreateForm(); form.Controls.Add(noteEditor); form.Shown += (sender, args) => { var ptree1 = persistence.NewTree(); var c1 = new MapNode(ptree1.Tree.RootNode, "c1"); c1.Selected = true; var sut = new NoteMapGlue(noteEditor, persistence); c1.NoteText = "ABC"; noteEditor.HTML = "EFG"; sut.UpdateNodeFromEditor(); result = c1.NoteText != null && c1.NoteText.Contains("ABC"); form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(result); }
public void NoteMapGlue_AssignNote_EditorUpdated() { bool result = true; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var persistence = new PersistenceManager(); var noteEditor = new NoteEditor(); var form = CreateForm(); form.Controls.Add(noteEditor); form.Shown += (sender, args) => { var tree = persistence.NewTree(); var sut = new NoteMapGlue(noteEditor, persistence); tree.Tree.RootNode.NoteText = "ABC"; result = noteEditor.HTML != null && noteEditor.HTML.Contains("ABC"); form.Close(); }; form.ShowDialog(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(result); }
public NoteEditorCtrl(NoteEditor editor, PersistenceManager pManager) { this.noteGlue = new NoteMapGlue(editor, pManager); }