Exemplo n.º 1
0
        public void TestInitialize()
        {
            ICDbContext context = new ICDbContext(connectionString);

            context.Set <User>().AddOrUpdate(testUsers.ToArray());
            context.SaveChanges();
            userRepo = new UserRepository(context);
        }
Exemplo n.º 2
0
        public static void TestInitialize(TestContext testContext)
        {
            ICDbContext context = new ICDbContext(connectionString);

            context.Set <User>().AddOrUpdate(t => new { t.UserName }, testUsers.ToArray());
            context.SaveChanges();
            repo = new Repository <User>(context);
        }
Exemplo n.º 3
0
        public void Should_Return_Users_When_Searching_By_First_And_Last_Name(string firstName, string lastName)
        {
            ICDbContext context = new ICDbContext(connectionString);

            context.Set <User>().AddOrUpdate(testUsers.ToArray());
            context.SaveChanges();
            userRepo = new UserRepository(context);
            List <User> result = userRepo.GetByFirstAndLastName(firstName, lastName).ToList();

            foreach (User user in result)
            {
                Xunit.Assert.True(user.FirstName == firstName && user.LastName == lastName, "Did not find the correct users by first and last name.");
            }
            userRepo.Dispose();
            Database.Delete(connectionString);
        }
Exemplo n.º 4
0
 public Repository(ICDbContext context)
 {
     this.dbContext = context;
     DbSet          = dbContext.Set <T>();
 }
Exemplo n.º 5
0
 public Repository()
 {
     this.dbContext = new ICDbContext();
     DbSet          = dbContext.Set <T>();
 }