Пример #1
0
        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);
        }
Пример #2
0
 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;
 }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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);
        }
Пример #10
0
        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);
        }
Пример #11
0
 public NoteEditorCtrl(NoteEditor editor, PersistenceManager pManager)
 {
     this.noteGlue = new NoteMapGlue(editor, pManager);
 }