Exemple #1
0
        public void InitContext()
        {
            var optionsBuilder = new DbContextOptionsBuilder <AccountDb>();

            optionsBuilder.UseInMemoryDatabase();

            var context  = new AccountDb(optionsBuilder.Options);
            var accounts = Enumerable.Range(1, 10)
                           .Select(i => new Account {
                Id = i, First = $"Bob{i}", Last = "Test", Email = "*****@*****.**"
            });

            context.AddRange(accounts);
            int changed = context.SaveChanges();

            _accountContext = context;
        }