/// <summary> /// Checks whether given order can be added. /// Performs logical and business validation. /// </summary> public ValidationResult ValidateNewOrder(Order newOrder) { var result = ValidationResult.Default; if (newOrder == null) { throw new ArgumentNullException("newOrder"); } var items = queryAllItems.Execute(); foreach (var item in newOrder.OrderItems) { if (item.Value <= 0) { result |= ValidationResult.NoItemQuantity; } if (!items.Any(p => p.Id == item.Key)) { result |= ValidationResult.ItemDoesNotExist; } } if (result == ValidationResult.Default) { result = ValidationResult.Ok; } return(result); }
public void TestExecuteShouldReturnXAxisGridLines() { var results = _query.Execute(_controlSize); Assert.That(results, Has.Member(_xGridLine)); }
/// <summary> /// Lists all items that exist in db /// </summary> public IEnumerable <Item> All() { return(_query.Execute().ToList()); }