示例#1
0
        public void Archive(Note note)
        {
            _notesRepository.Save(note.Name, note.Content);

            var newName = _notesRepository.Archive(note.Name);

            NoteMetadata metadata = _notesMetadataService.Get(note.Name);

            metadata.Archived = DateTime.Now;

            _notesMetadataService.Remove(note.Name);
            _notesMetadataService.Add(Globals.ArchivePrefix + "/" + newName, metadata);

            _notesMetadataService.Save();

            Archived?.Invoke(this, new ArchivedNoteEventArgs
            {
                ArchivedNote = note
            });
        }
示例#2
0
        public void Add()
        {
            const string noteName = "dummy name";
            var          metadata = new NoteMetadata();

            _sut.Add(noteName, metadata);

            NoteMetadata retrieved = _sut.Get(noteName);

            Assert.Equal(metadata, retrieved);
        }