Ejemplo n.º 1
0
 public OrderItem CreateItem(Order order, Product product)
 {
     var orderItem = new OrderItem
     {
         Order = order,
         Price = 1,
         Product = product,
         Quantity = 3,
         Store = "Internet"
     };
     //_generator.Context.OrderItems.InsertOnSubmit(orderItem);
     _generator.EntityDeleteActions.Add(context => context.OrderItems.DeleteOnSubmit(orderItem));
     return orderItem;
 }
Ejemplo n.º 2
0
 partial void DeleteProduct(Product instance);
Ejemplo n.º 3
0
 partial void UpdateProduct(Product instance);
Ejemplo n.º 4
0
 partial void InsertProduct(Product instance);
Ejemplo n.º 5
0
 public Order CreateOrderForProducts(Product[] products)
 {
     var order = CreateOrderForCustomer(CreateCustomer());
     foreach (var product in products)
         order.OrderItems.Add(CreateItem(order, product));
     return order;
 }
Ejemplo n.º 6
0
 public Product[] CreateProducts(int count)
 {
     var products = new Product[count];
     for (var i = 0; i < count; i++)
         products[i] = CreateProduct();
     return products;
 }
Ejemplo n.º 7
0
 public Product CreateProduct()
 {
     var product = new Product
     {
         Name = "Product" + RandomString(),
         Description = "Product Description" + RandomString()
     };
     _generator.Context.Products.InsertOnSubmit(product);
     _generator.EntityDeleteActions.Add(context => context.Products.DeleteOnSubmit(product));
     return product;
 }