用于LINQ练习的测试数据

#region TestData

public enum Countries
{
    USA,
    Italy,
}

public class Customer
{
    public string Name;
    public string City;
    public Countries Country;
    public Order[] Orders;
}

public class Order
{
    public int Quantity;
    public bool Shipped;
    public string Month;
    public int IdProduct;
}

public class Product
{
    public int IdProduct;
    public decimal Price;
}

// -------------------------------------------------------
// Initialize a collection of customers with their orders:
// -------------------------------------------------------
private IEnumerable<Customer> customers = new[]
                                              {
                                                  new Customer
                                                      {
                                                          Name = "Paolo",
                                                          City = "Brescia",
                                                          Country = Countries.Italy,
                                                          Orders =
                                                              new[
                                                              ]
                                                                  {
                                                                      new Order
                                                                          {
                                                                              Quantity
                                                                                  =
                                                                                  3,
                                                                              IdProduct
                                                                                  =
                                                                                  1,
                                                                              Shipped
                                                                                  =
                                                                                  false,
                                                                              Month
                                                                                  =
                                                                                  "January"
                                                                          }
                                                                      ,
                                                                      new Order
                                                                          {
                                                                              Quantity
                                                                                  =
                                                                                  5,
                                                                              IdProduct
                                                                                  =
                                                                                  2,
                                                                              Shipped
                                                                                  =
                                                                                  true,
                                                                              Month
                                                                                  =
                                                                                  "May"
                                                                          }
                                                                  }
                                                      },
                                                  new Customer
                                                      {
                                                          Name = "Marco",
                                                          City = "Torino",
                                                          Country = Countries.Italy,
                                                          Orders =
                                                              new[
                                                              ]
                                                                  {
                                                                      new Order
                                                                          {
                                                                              Quantity
                                                                                  =
                                                                                  10,
                                                                              IdProduct
                                                                                  =
                                                                                  1,
                                                                              Shipped
                                                                                  =
                                                                                  false,
                                                                              Month
                                                                                  =
                                                                                  "July"
                                                                          }
                                                                      ,
                                                                      new Order
                                                                          {
                                                                              Quantity
                                                                                  =
                                                                                  20,
                                                                              IdProduct
                                                                                  =
                                                                                  3,
                                                                              Shipped
                                                                                  =
                                                                                  true,
                                                                              Month
                                                                                  =
                                                                                  "December"
                                                                          }
                                                                  }
                                                      },
                                                  new Customer
                                                      {
                                                          Name = "James",
                                                          City = "Dallas",
                                                          Country = Countries.USA,
                                                          Orders =
                                                              new[
                                                              ]
                                                                  {
                                                                      new Order
                                                                          {
                                                                              Quantity
                                                                                  =
                                                                                  20,
                                                                              IdProduct
                                                                                  =
                                                                                  3,
                                                                              Shipped
                                                                                  =
                                                                                  true,
                                                                              Month
                                                                                  =
                                                                                  "December"
                                                                          }
                                                                  }
                                                      },
                                                  new Customer
                                                      {
                                                          Name = "Frank",
                                                          City = "Seattle",
                                                          Country = Countries.USA,
                                                          Orders =
                                                              new[
                                                              ]
                                                                  {
                                                                      new Order
                                                                          {
                                                                              Quantity
                                                                                  =
                                                                                  20,
                                                                              IdProduct
                                                                                  =
                                                                                  5,
                                                                              Shipped
                                                                                  =
                                                                                  false,
                                                                              Month
                                                                                  =
                                                                                  "July"
                                                                          }
                                                                  }
                                                      }
                                              };

private IEnumerable<Product> products = new[]
                                            {
                                                new Product {IdProduct = 1, Price = 10},
                                                new Product {IdProduct = 2, Price = 20},
                                                new Product {IdProduct = 3, Price = 30},
                                                new Product {IdProduct = 4, Price = 40},
                                                new Product {IdProduct = 5, Price = 50},
                                                new Product {IdProduct = 6, Price = 60}
                                            };

#endregion
posted @ 2009-01-23 20:47  蜡笔小王  阅读(655)  评论(0编辑  收藏  举报