Esempio n. 1
0
        [Platform(Exclude = "Mono")]       //running CreateNotesBrowser twice in a mono test session causes a crash
        public void GetNotesBarAndBrowser_MakeNewAnnotationWithBar_BrowserSeesIt()
        {
            NotesToRecordMapping mapping = NotesToRecordMapping.SimpleForTest();
            var bar     = _system.WinForms.CreateNotesBar(_targetFile1.Path, mapping, _progress);
            var browser = _system.WinForms.CreateNotesBrowser();

            Assert.AreEqual(1, browser._notesInProjectModel.GetMessages().Count());

            bar.SetTargetObject(this);
            var a = bar._model.CreateAnnotation();

            bar._model.AddAnnotation(a);
            a.AddMessage("test", "open", "hello");
            Assert.AreEqual(2, browser._notesInProjectModel.GetMessages().Count());
        }
Esempio n. 2
0
        public void ShowNotesBar()
        {
            using (var folder = new TemporaryFolder("NotesModelTests"))
                using (var dataFile = new TempFileFromFolder(folder, "one.txt", "just a pretend file"))
                    using (new TempFileFromFolder(folder, "one.txt." + AnnotationRepository.FileExtension,
                                                  @"<notes version='0'>
					<annotation ref='somwhere://foo?id=x' class='question'>
						<message guid='123' author='john' status='open' date='2009-07-18T23:53:04Z'>
							Suzie, is this ok?
						</message>
						<message guid='222' author='suzie' status='closed' date='2009-09-19T23:53:04Z'>
							It's fine.
						</message>
					</annotation>
					<annotation ref='lift://name%20with%20space.lift?id=x' class='mergeConflict'>
						<message guid='123' author='merger' status='open' date='2009-07-18T23:53:04Z'>
							some description of the conflict
						</message>
					</annotation>
					<annotation ref='somwhere://foo2?id=y' class='note'/>
				</notes>"                ))
                    {
                        var chorus = new ChorusSystem(folder.Path);
                        var view   = chorus.WinForms.CreateNotesBar(dataFile.Path, NotesToRecordMapping.SimpleForTest(), _progress);
                        view.Height = 32;
                        view.SetTargetObject("x");

                        TextBox b = new TextBox();
                        b.Location     = new Point(0, 50);
                        b.Text         = "x";
                        b.TextChanged += new EventHandler((s, e) => view.SetTargetObject(b.Text));
                        var form = new Form();
                        form.Size = new Size(700, 600);
                        form.Controls.Add(view);
                        form.Controls.Add(b);

                        Application.EnableVisualStyles();
                        Application.Run(form);
                    }
        }
Esempio n. 3
0
 internal NotesBarModel(IAnnotationRepository repository)
     : this(repository, NotesToRecordMapping.SimpleForTest())
 {
 }