Ejemplo n.º 1
0
        public void AddChecklistShouldReturnCheckList()
        {
            Checklist checklist = new Checklist {
                Content = "Code First", NoteId = 1
            };
            var actual = noteRepo.AddChecklist(checklist);

            actual.ChecklistId.Should().Be(3);
            actual.Content.Should().Be("Code First");
        }
        public Checklist AddChecklist(int noteId, Checklist checklist)
        {
            try
            {
                var result = noteRepository.AddChecklist(checklist);
                if (result == null)
                {
                    throw new ChecklistNotFoundException(string.Format("Checklist item with id {0} not found", checklist?.ChecklistId));
                }

                return(result);
            }
            catch (ChecklistNotFoundException)
            {
                throw;
            }
            catch (Exception)
            {
                // unhandled exception
                throw;
            }
        }
Ejemplo n.º 3
0
 public Checklist AddChecklist(int noteId, Checklist checklist)
 {
     return(noteRepository.AddChecklist(checklist));
 }