public void GivenJSONServiceAndNote_WhenSavingFileAndClosingApp_ThenTheSameNoteShouldBeLoadedViaMetaDataFileNextTimeAfterOpeningApp()
        {
            NoteKeeperOperator noteKeeperOperator = new NoteKeeperOperator(new JSONStorageService(), PATH);

            noteKeeperOperator.SaveWithDynamicFileName("Titel", "Foo");
            Note expectedNote = noteKeeperOperator.Note;

            noteKeeperOperator = new NoteKeeperOperator(new JSONStorageService(), PATH);
            noteKeeperOperator.OpenLastSavedNoteViaMetaData();
            Note actualNote = noteKeeperOperator.Note;

            Assert.Equal(expectedNote.Title, actualNote.Title);
            Assert.Equal(expectedNote.Text, actualNote.Text);
            Assert.Equal(expectedNote.Created.ToString(), actualNote.Created.ToString());
            Assert.Equal(expectedNote.LastEdited.ToString(), actualNote.LastEdited.ToString());
        }
Пример #2
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(NoteTitleTextBox.Text))
     {
         MessageBox.Show("Title is empty!");
         return;
     }
     try
     {
         _noteKeeperOperator.SaveWithDynamicFileName(NoteTitleTextBox.Text, NoteTextBox.Text);
         UpdateNoteOnForms();
         MessageBox.Show("File has been saved!");
     }
     catch (IOException io)
     {
         MessageBox.Show("An Error has occured: \n\n" + io.Message);
     }
 }