public void AfterScenario() { using (dbContext = new NorthwindEntitiesInTest()) { dbContext.Database.ExecuteSqlCommand("Delete [Orders] Where CustomerID IN ('Joey','JoeyTest')"); dbContext.Database.ExecuteSqlCommand("Delete [Customers] Where CustomerID IN('Joey','JoeyTest')"); } }
public void BeforeScenario() { this.target = new OrderService(); using (dbContext = new NorthwindEntitiesInTest()) { dbContext.Database.ExecuteSqlCommand("Delete [Orders] Where CustomerID IN ('Joey','JoeyTest')"); dbContext.Database.ExecuteSqlCommand("Delete [Customers] Where CustomerID IN('Joey','JoeyTest')"); } }
public void Given預計Orders資料應有(Table table) { var orders = table.CreateSet<SpecFlowWithEf.Tests.ModelInTest.Orders>(); using (dbContext = new NorthwindEntitiesInTest()) { foreach (var order in orders) { dbContext.Orders.Add(order); } dbContext.SaveChanges(); } }