Exemple #1
0
        private LandmarkDbSqlContext MockDbContext()
        {
            // Insert seed data into the database using one instance of the context
            using (var context = new LandmarkDbSqlContext(true))
            {
                try
                {
                    context.Users.Add(GetTestUser());
                    context.Landmarks.Add(GetTestLandmark());
                    context.SaveChanges();
                }
                catch { }
            }

            // Use a clean instance of the context to run the tests against
            return(new LandmarkDbSqlContext(true));
        }
 public LandmarkSqlRepository(LandmarkDbSqlContext dbContext = null)
 {
     _dbContext = dbContext ?? new LandmarkDbSqlContext();
 }