예제 #1
0
        private static void Build()
        {
            if (_orders.Any())
            {
                return;
            }
            var addressCount  = AddressSeeder.Count();
            var customerCount = CustomerSeeder.Count();
            var orders        = new List <Order>();

            for (var i = 1; i <= 1500; i++)
            {
                var customerId = (customerCount - i) % i;
                if (!(customerId > 0 && customerId < customerCount))
                {
                    customerId = 25;
                }
                var deliveryAddressId = i % addressCount + 1;
                if (deliveryAddressId < 2)
                {
                    deliveryAddressId = 3;
                }
                if (deliveryAddressId > addressCount)
                {
                    deliveryAddressId = addressCount - 1;
                }
                var invoiceAddressId = i % 5 == 0 ? 3 : deliveryAddressId;

                orders.Add(BuildItem(i, customerId, deliveryAddressId, invoiceAddressId));
            }

            _orders = orders;
        }
예제 #2
0
 public bool DbIsHealthy(WebshopContext context)
 {
     return(context.ProductCategories.Count() == ProductCategorySeeder.Count() &&
            context.Addresses.Count() == AddressSeeder.Count() &&
            context.Customers.Count() == CustomerSeeder.Count() &&
            context.Images.Count() == ImageSeeder.Count() &&
            context.Warehouses.Count() == WarehouseSeeder.Count() &&
            context.Products.Count() == ProductSeeder.Count() &&
            context.Orders.Count() == OrderSeeder.Count() &&
            context.OrderProducts.Count() == OrderProductSeeder.Count());
 }