Skip to content

Instantly share code, notes, and snippets.

@detroitpro
Created February 19, 2017 15:58
Show Gist options
  • Save detroitpro/2cb0ce9fb6f713d1fc86857a2f6487f5 to your computer and use it in GitHub Desktop.
Save detroitpro/2cb0ce9fb6f713d1fc86857a2f6487f5 to your computer and use it in GitHub Desktop.
How to unit teset EFCore

var builder = new DbContextOptionsBuilder().UseInMemoryDatabase();

var context = new MyContext(builder.Options); var users = Enumerable.Range(1, 10).Select(i => new User { Id = i }); context.Users.AddRange(users); context.SaveChanges();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment