public virtual void Add(params T[] items) { foreach (T item in items) { _context.Entry(item).State = EntityState.Added; } _context.SaveChanges(); }
public void Test() { User u = new User { Username = "******", PasswordSalt = "s", PasswordHash = "h", LastLoginDate = DateTime.UtcNow, LastApplicationUsed = "this", LoginAttempts = 0, LastLoginAttempt = DateTime.UtcNow, CreatedOn = DateTime.UtcNow }; _context.User.Add(u); _context.SaveChanges(); string username = _context.User.FirstAsync().Result.Username; Assert.True(username == "TestUsertest"); _context.User.Remove(u); _context.SaveChanges(); }