public void GivenBudgetTableExistedBudgets(Table table) { var budgets = table.CreateSet <Budget>(); using (var dbcontext = new BudgetContextForTest()) { dbcontext.Budgets.AddRange(budgets); dbcontext.SaveChanges(); } }
public void ThenItShouldExistABudgetRecordInBudgetTable(Table table) { using (var dbcontext = new BudgetContextForTest()) { var budget = dbcontext.Budgets .FirstOrDefault(); budget.Should().NotBeNull(); table.CompareToInstance(budget); } }
private static void CleanTableByTags() { var tags = ScenarioContext.Current.ScenarioInfo.Tags .Where(x => x.StartsWith("Clean")) .Select(x => x.Replace("Clean", "")); if (!tags.Any()) { return; } using (var dbcontext = new BudgetContextForTest()) { foreach (var tag in tags) { dbcontext.Database.ExecuteSqlCommand($"TRUNCATE TABLE [{tag}]"); } dbcontext.SaveChangesAsync(); } }