Ejemplo n.º 1
0
        public void WriteNote_NoteFileExists_NoteFileIsOverwritten()
        {
            DiskStorage storage = new DiskStorage (NOTE_FOLDER_TEMP);

            string note_name = "existing_note.note";
            string note_path = Path.Combine (NOTE_FOLDER_TEMP, note_name);

            System.IO.File.WriteAllText (note_path, "Test");

            storage.Write (note_name, TesterNote.GetTesterNote ());

            string noteContents = System.IO.File.ReadAllText (note_path);
            Assert.AreNotEqual (noteContents, "Test", "The pre-existing note has not been overwritten!");

            System.IO.File.Delete (note_path); //Clear up test for next time
        }
Ejemplo n.º 2
0
        public void WriteNote_NoteFileDoesNotExist_NoteFileIsCreated()
        {
            DiskStorage storage = new DiskStorage (NOTE_FOLDER_TEMP);

            string note_name = "90d8eb70-989d-4b26-97bc-ba4b9442e51d.note";
            string note_path = Path.Combine (NOTE_FOLDER_TEMP, note_name);
            System.IO.File.Delete (note_path); //Make sure it doesn't exist from before

            storage.Write (note_name, TesterNote.GetTesterNote ());
            Assert.IsTrue (System.IO.File.Exists (note_path));

            System.IO.File.Delete (note_path); //Clear up test for next time
        }