Пример #1
0
        private static IList <SimpleOpenCustomer> CreateCustomers()
        {
            int[] IntValues = { 200, 100, 300, 0, 400 };
            IList <SimpleOpenCustomer> customers = Enumerable.Range(0, 5).Select(i =>
                                                                                 new SimpleOpenCustomer
            {
                CustomerId = i,
                Name       = "FirstName " + i,
                Address    = new SimpleOpenAddress
                {
                    Street     = "Street " + i,
                    City       = "City " + i,
                    Properties = new Dictionary <string, object> {
                        { "IntProp", IntValues[i] }
                    }
                },
                Website = "WebSite #" + i
            }).ToList();

            customers[2].CustomerProperties = new Dictionary <string, object>
            {
                { "Token", new Guid("2C1F450A-A2A7-4FE1-A25D-4D9332FC0694") },
                { "IntList", new List <int> {
                      1, 2, 3, 4, 5, 6, 7
                  } },
            };

            SimpleOpenAddress address = new SimpleOpenAddress
            {
                Street = "SubStreet",
                City   = "City"
            };

            customers[3].CustomerProperties = new Dictionary <string, object> {
                { "ComplexList", new[] { address, address } }
            };

            SimpleVipCustomer vipCustomer = new SimpleVipCustomer
            {
                CustomerId = 9,
                Name       = "VipCustomer",
                Address    = new SimpleOpenAddress
                {
                    Street = "Vip Street ",
                    City   = "Vip City ",
                },
                VipNum             = "99-001",
                CustomerProperties = new Dictionary <string, object>
                {
                    { "ListProp", IntValues },
                    { "DateList", new[] { Date.MinValue, Date.MaxValue } }
                }
            };

            customers.Add(vipCustomer);
            return(customers);
        }
Пример #2
0
        private static IList<SimpleOpenCustomer> CreateCustomers()
        {
            int[] IntValues = { 200, 100, 300, 0, 400 };
            IList<SimpleOpenCustomer> customers = Enumerable.Range(0, 5).Select(i =>
                new SimpleOpenCustomer
                {
                    CustomerId = i,
                    Name = "FirstName " + i,
                    Address = new SimpleOpenAddress
                    {
                        Street = "Street " + i,
                        City = "City " + i,
                        Properties = new Dictionary<string, object> { { "IntProp", IntValues[i] } }
                    },
                    Website = "WebSite #" + i
                }).ToList();

            customers[2].CustomerProperties = new Dictionary<string, object>
            {
                {"Token", new Guid("2C1F450A-A2A7-4FE1-A25D-4D9332FC0694")},
                {"IntList", new List<int> { 1, 2, 3, 4, 5, 6, 7 }},
            };

            customers[4].CustomerProperties = new Dictionary<string, object>
            {
                {"Token", new Guid("A6A594ED-375B-424E-AC0A-945D89CF7B9B")},
                {"IntList", new List<int> { 1, 2, 3, 4, 5, 6, 7 }},
            };

            SimpleOpenAddress address = new SimpleOpenAddress
            {
                Street = "SubStreet",
                City = "City"
            };
            customers[3].CustomerProperties = new Dictionary<string, object> { { "ComplexList", new[] { address, address } } };

            SimpleVipCustomer vipCustomer = new SimpleVipCustomer
            {
                CustomerId = 9,
                Name = "VipCustomer",
                Address = new SimpleOpenAddress
                {
                    Street = "Vip Street ",
                    City = "Vip City ",
                },
                VipNum = "99-001",
                CustomerProperties = new Dictionary<string, object>
                {
                    { "ListProp", IntValues },
                    { "DateList", new[] { Date.MinValue, Date.MaxValue } },
                    { "Receipt", null }
                }
            };

            customers.Add(vipCustomer);
            return customers;
        }