public void HappyParse() { var parser = new NoteParser(new FileInfo("TestNoteFiles/SimpleHappyPath.ntf")); var result = parser.GetTree(); Assert.IsNotNull(result); }
public void BareStringTree() { const string expected = "This is a test of the BareString method to see if it works"; var parser = new NoteParser(new FileInfo(BAREPATH)); var tree = parser.GetTree(); var result = tree.ToBareString(); Assert.AreEqual(expected, result); }
public void MissingHeaderParse() { var parser = new NoteParser(new FileInfo(NOHEADERPATH)); var tree = parser.GetTree(); var tags = tree.GetTags(); Assert.IsTrue(tags.Contains("intro"), "Tag \"intro\" is missing from the list of tags"); Assert.IsTrue(tags.Contains("date"), "Tag \"date\" is missing from the list of tags"); Assert.IsTrue(tags.Contains("name"), "Tag \"name\" is missing from the list of tags"); Assert.IsTrue(tags.Contains("context"), "Tag \"context\" is missing from the list of tags"); }
public void RealTreeToString() { var parser = new NoteParser(new FileInfo(PATH)); var tree = parser.GetTree(); var output = tree.ToString(); var parser2 = new NoteParser(output); var tree2 = parser2.GetTree(); var result = tree2.ToString(); Assert.AreEqual(output, result); }
public void NotesToString() { var note = new NoteNode("test", "test"); var tree = new NoteTree(note); var output = tree.ToString(); var parser = new NoteParser(output); var tree2 = parser.GetTree(); var output2 = tree2.ToString(); Assert.AreEqual(output, output2); }
//TODO: Fix the tag completion logic, its shit right now /// <summary> /// Method that is called when the composer text box is edited in any way. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnTextEntryChanged(object sender, RoutedEventArgs e) { var textBox = (RichEditBox)sender; var data = ""; this.Document.GetText(TextGetOptions.None, out data); if (!_skipEvent && data.Trim().Any()) { //Debug.WriteLine(data[textBox.SelectionStart - 1]); if (data[textBox.Document.Selection.StartPosition - 1] == '<') { _enteringTagMode = true; _inTagMode = false; _skipEvent = true; var start = textBox.Document.Selection.StartPosition; data = data.Insert(textBox.Document.Selection.StartPosition, "></>"); textBox.Document.SetText(TextSetOptions.None, data); textBox.Document.Selection.StartPosition = start; textBox.Document.Selection.EndPosition = start; } } else { _skipEvent = false; } try { NoteParser parser = new NoteParser("<NoteTag>" + data + "</>"); var tree = parser.GetTree(); Tags = tree.GetTags(); TagsUpdated(Tags); } catch (BadFormedTagFileException ex) { } }
public void NoNoteTags() { var parser = new NoteParser("test123"); var tree = parser.GetTree(); var tags = tree.GetTags(); }