Ejemplo n.º 1
0
        public void GivenBudgetTableHasABudget(Table table)
        {
            var db = new TestModels.TestGOOSEntities();

            db.Budgets.AddRange(table.CreateSet <Budgets>());
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public void ThenItShouldExistABudgetRecordInBudgetTable(Table table)
        {
            var db     = new TestModels.TestGOOSEntities();
            var budget = db.Budgets.FirstOrDefault();

            budget.Should().NotBeNull();
            table.CompareToInstance(budget);
        }
Ejemplo n.º 3
0
        public static void CleanTestData()
        {
            var tags = ScenarioContext.Current.ScenarioInfo.Tags
                       .Where(x => x.StartsWith("Clean"))
                       .Select(x => x.Replace("Clean", ""));

            if (!tags.Any())
            {
                return;
            }
            using (var dbcontext = new TestModels.TestGOOSEntities())
            {
                foreach (var tag in tags)
                {
                    dbcontext.Database.ExecuteSqlCommand($"TRUNCATE TABLE [{tag}s]");
                }
                dbcontext.SaveChangesAsync();
            }
        }