/// <summary> /// Inserts a subset (250 records) of Ingredient test data into <paramref name="context"/> using the USDA Food Composition ETL process. /// </summary> /// <param name="context"></param> internal static void InitializeIngredientsFromUSDA(PantryPlannerContext context) { // load ingredient data into in-memory database USDAFoodCompositionDbETL etl = new USDAFoodCompositionDbETL(FoodCompositionETLUnitTest.FoodCompositionFolderLocation); etl.StartEtlProcess(context, 250); // mark a few ingredients as created by TestUser for test purposes for (int i = 0; i < 5; i++) { Ingredient ingredient = context.Ingredient.Skip(i).FirstOrDefault(); ingredient.AddedByUserId = TestUserID; context.Entry(ingredient).State = EntityState.Modified; } context.SaveChanges(); }
public FoodCompositionETLUnitTest() { _context = InMemoryDataGenerator.CreateInMemoryDatabaseContext("FoodCompositionETLUnitTestDB"); _etl = new USDAFoodCompositionDbETL(FoodCompositionFolderLocation); }