public void AddNote_CustomDayWithNotes_AddsNewNote() { var length = _customDayWithNotes.Notes.Count; _customDayWithNotes.AddNote(_note1); Assert.Equal(length + 1, _customDayWithNotes.Notes.Count); }
public ActionResult <Note> AddNote(DateTime date, NoteDTO model) { CustomDay customDayToEdit = _customDayRepository.GetByDate(date); if (customDayToEdit == null) { return(NotFound()); } else { try { Note noteToAdd = new Note(model.NoteType, model.Content); customDayToEdit.AddNote(noteToAdd); _customDayRepository.SaveChanges(); return(Ok(noteToAdd)); } catch (Exception ex) { return(BadRequest(ex.Message)); } } }