Ejemplo n.º 1
0
 public void GivenTheFollowingBooks(Table table)
 {
     var db = new BookShopEntities();
     foreach (var row in table.Rows)
     {
         Book book = new Book { Author = row["Author"], Title = row["Title"], Price = Convert.ToDecimal(row["Price"]) };
         if (table.Header.Contains("Id"))
             ReferenceBooks.Add(row["Id"], book);
         db.AddToBooks(book);
     }
     db.SaveChanges();
 }
 public void CleanDatabase()
 {
     var db = new BookShopEntities();
     foreach (var lineItem in db.OrderLines)
     {
         db.DeleteObject(lineItem);
     }
     foreach (var order in db.Orders)
     {
         db.DeleteObject(order);
     }
     foreach (var book in db.Books)
     {
         db.DeleteObject(book);
     }
     db.SaveChanges();
 }