public async Task DeleteNote() { using (var context = new NoteContext(ContextOptions)) { var controller = new NotesController(context); var response = await controller.DeleteNote(1); Assert.False(context.Set <Note>().Any(e => e.Id == 1)); } }
public async Task PostNote() { using (var context = new NoteContext(ContextOptions)) { var controller = new NotesController(context); var newNote = new Note() { Id = 5, Title = "Hobby", Body = "Play hockey", IsComplete = true }; var response = await controller.PostNote(newNote); var note = context.Set <Note>().Single(e => e.Id == 5); Assert.Equal(5, note.Id); } }
public BaseRepository(NoteContext _context) { context = _context; dbSet = context.Set <T>(); }