Beispiel #1
0
        static void TestDeleteNote(NoteDatabase db, List <KnowledgeBase> kbList)
        {
            var toDelete = new List <Note>();

            foreach (var kb in kbList)
            {
                toDelete.AddRange(db.FetchNote(kb.Name));
            }
            foreach (var note in toDelete)
            {
                // Delete
                db.DeleteNote(note.Directory, note.Title);

                // Try to fetch
                var result = db.FetchNote(note.Directory, note.Title);

                // Check result
                if (result == Note.VoidNote)
                {
                    Console.WriteLine($"Delete note {note.Title}");
                }
                else
                {
                    Console.WriteLine($"Delete note failed: {note.Title}");
                    Console.ReadKey();
                }

                // Restore
                db.AddNote(note);
            }
        }
Beispiel #2
0
 public static void AddNotes(NoteDatabase db, List <Note> noteList)
 {
     foreach (var note in noteList)
     {
         db.AddNote(note);
         Console.WriteLine($"Add note {note.Title}\n");
     }
 }