Exemplo n.º 1
0
        public void Test_Common()
        {
            using (GDMNoteRecord noteRec = new GDMNoteRecord(null)) {
                Assert.AreEqual(GDMRecordType.rtNote, noteRec.RecordType);

                noteRec.AddNoteText("text");
                Assert.AreEqual("text", noteRec.Lines.Text.Trim());

                Assert.Throws(typeof(ArgumentNullException), () => {
                    noteRec.SetNoteText(null);
                });

                noteRec.SetNoteText("Test text");
                Assert.AreEqual("Test text", noteRec.Lines.Text.Trim());

                using (GDMNoteRecord noteRec2 = new GDMNoteRecord(null)) {
                    noteRec2.SetNoteText("Test text");
                    Assert.AreEqual("Test text", noteRec2.Lines.Text.Trim());

                    Assert.AreEqual(100.0f, noteRec.IsMatch(noteRec2, new MatchParams()), 0.01f);

                    Assert.IsFalse(noteRec2.IsEmpty());
                    noteRec2.Clear();
                    Assert.IsTrue(noteRec2.IsEmpty());

                    Assert.AreEqual(0.0f, noteRec.IsMatch(noteRec2, new MatchParams()), 0.01f);

                    Assert.AreEqual(0.0f, noteRec.IsMatch(null, new MatchParams()), 0.01f);
                }

                Assert.Throws(typeof(ArgumentException), () => {
                    noteRec.MoveTo(null);
                });

                Assert.Throws(typeof(ArgumentException), () => {
                    noteRec.Assign(null);
                });

                using (GDMNoteRecord noteRec3 = new GDMNoteRecord(null)) {
                    noteRec3.SetNoteText("Test text 3");
                    Assert.AreEqual("Test text 3", noteRec3.Lines.Text.Trim());

                    noteRec.MoveTo(noteRec3);

                    Assert.AreEqual("Test text 3", noteRec3.Lines.Text.Trim());
                }
            }
        }
Exemplo n.º 2
0
        public void Test_MoveTo2()
        {
            string[] lines = new string[] {
                "This is a test line 1",
                "This is a test line 2",
                "This is a test line 3"
            };

            string text = "This is a test";

            GDMNoteRecord instance1 = new GDMNoteRecord(null);

            instance1.ParseString(text);

            GDMNoteRecord instance2 = new GDMNoteRecord(null);

            instance2.SetNotesArray(lines);

            instance1.MoveTo(instance2);

            // moveTo preserved existing note text
            StringList value = new StringList(lines);

            Assert.AreEqual(value.Text, instance2.Lines.Text);
        }
Exemplo n.º 3
0
        public void Test_MoveTo1()
        {
            GDMRecord     other    = new GDMLocationRecord(null);
            GDMNoteRecord instance = new GDMNoteRecord(null);

            Assert.Throws(typeof(ArgumentException), () => {
                instance.MoveTo(other);
            });
        }