public async void CanDelete() { DbContextOptionsBuilder <School_Context> builder = new DbContextOptionsBuilder <School_Context>(); builder.UseInMemoryDatabase(); DbContextOptions <School_Context> options = builder.Options; _context = new School_Context(options); Student student = new Student() { FirstName = "jimmy" }; _context.Student.Add(student); _context.SaveChanges(); Student foundEntity = _context.Student.FirstOrDefault(x => x.FirstName == student.FirstName); Assert.NotNull(foundEntity); }
// setting the Controller to _context public CourseController(School_Context context) { _context = context; }
// setting the Controller to _context public StudentController(School_Context context) { _context = context; }