Esempio n. 1
0
        public void AddNoteTest()
        {
            var main = new MainPageViewModel();
            int prev = main.NoteTitles.Length;
            var note = new Note(Guid.NewGuid().ToString(), DateTime.Now, "This is an automatically generated note.", MainPageViewModel.IsolatedStorage);
            main.NoteTitles = Note.GetNoteList(MainPageViewModel.IsolatedStorage);

            Assert.AreEqual(main.NoteTitles.Length, prev + 1);
            Note.DeleteNote(note.Title, MainPageViewModel.IsolatedStorage);
        }
Esempio n. 2
0
        public void BindNotePropertiesTest()
        {
            var viewNote = new ViewNoteViewModel();
            var note = new Note(Guid.NewGuid().ToString(), DateTime.Now, "This is an automatically generated note.", MainPageViewModel.IsolatedStorage);
            viewNote.CurrentNote = note;

            viewNote.NoteBody = "This is my new body.";

            Assert.AreEqual(viewNote.NoteBody, viewNote.CurrentNote.Body);
        }
Esempio n. 3
0
        public void SelectedNoteResetTest()
        {
            var main = new MainPageViewModel();
            var note = new Note(Guid.NewGuid().ToString(), DateTime.Now, "This is an automatically generated note.", MainPageViewModel.IsolatedStorage);

            main.NoteTitles = Note.GetNoteList(MainPageViewModel.IsolatedStorage);
            main.SelectedNoteIndex = 0;

            Assert.AreEqual(-1, main.SelectedNoteIndex);
            Note.DeleteNote(note.Title, MainPageViewModel.IsolatedStorage);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the ViewNoteViewModel class.
        /// </summary>
        public ViewNoteViewModel()
        {
            if (IsInDesignMode)
                return;

            CurrentNote = new Note();

            Messenger.Default.Register<Note>(this, MessengerTokenType.DisplayNote, note =>
            {
                NoteTitle = note.Title;
                NoteDateTime = note.DateTime.ToShortDateString();
                NoteBody = note.Body;
            });

            _timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(10)};
            _timer.Tick += (sender, args) => SaveNote();
            _timer.Start();
        }
Esempio n. 5
0
 public void NoteListTest()
 {
     var note = new Note("Test Note", DateTime.Now, "This is a test note.", MainPageViewModel.IsolatedStorage);
     Assert.IsTrue(Note.GetNoteList(MainPageViewModel.IsolatedStorage).Contains("Test Note"));
     Note.DeleteNote("Test Note", MainPageViewModel.IsolatedStorage);
 }