Ejemplo n.º 1
0
 public virtual void Add(params T[] items)
 {
     foreach (T item in items)
     {
         _context.Entry(item).State = EntityState.Added;
     }
     _context.SaveChanges();
 }
Ejemplo n.º 2
0
        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();
        }