Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 public BaseRepository(NoteContext _context)
 {
     context = _context;
     dbSet   = context.Set <T>();
 }