コード例 #1
0
        public void EditNoteTest_When_IdMoreThenListCount_Then_Error(int number)
        {
            var repository = new NoteRepository(mock.Object);

            repository.AddNote(newTitle, newText);

            Assert.Throws <InvalidOperationException>(() => repository.EditNote(number + 5, newTitle, newText));
        }
コード例 #2
0
        public void EditNoteTest_When_ValidData_Then_Edit(int number, string title, string text)
        {
            var repository = new NoteRepository(mock.Object);

            for (var i = 0; i <= number + 1; i++)
            {
                repository.AddNote($"{oldTitle}{i}", $"{oldTitle}{i}");
            }

            repository.EditNote(number, title, text);
            var notes = repository.GetNotes();

            Assert.True(!notes.Exists(x => x.Title == $"{oldTitle}{number}" && x.Text == $"{oldText}{number}") &&
                        notes.Exists(x => x.Title == title && x.Text == text));
        }