Exemple #1
0
        public void ThenThereShouldBeASingleOrderWithIdAndAutoscheduled(string id, bool autoscheduled)
        {
            using (var dbContext = _ruleRunner.BuildDbContext())
            {
                var orders = dbContext
                             .Orders
                             .ToList();

                if (orders.Count > 1)
                {
                    throw new Exception("There are more than 1 orders in the database");
                }

                var order = orders.Where(x => x.ClientOrderId == id && x.Autoscheduled == autoscheduled).SingleOrDefault();

                if (order == null)
                {
                    throw new Exception($"Could not find order with client id \"{id}\" and autoscheduled \"{autoscheduled}\"");
                }
            }
        }