private static void CheckItemValueOperation(OperationWay operationWay, int operand, int currentItemValue, int originalItemValue) { switch (operationWay) { case OperationWay.Reduced: Check.That(currentItemValue).IsEqualTo(originalItemValue - operand); break; case OperationWay.Increased: Check.That(currentItemValue).IsEqualTo(originalItemValue + operand); break; case OperationWay.Equal: Check.That(currentItemValue).IsEqualTo(operand); break; case OperationWay.LowerOrEqual: Check.That(currentItemValue <= operand).IsTrue(); break; case OperationWay.Unknown: default: throw new ArgumentOutOfRangeException("stepWay"); } }
public void ThenItemsXPropertyIsYModifiedBy(CheckedProperty checkedProperty, OperationWay operationWay, int operand) { foreach (var currentItem in _program.Items) { var originalItem = _originalItems.Single(o => o.Name == currentItem.Name); switch (checkedProperty) { case CheckedProperty.SellIn: CheckItemValueOperation(operationWay, operand, currentItem.SellIn, originalItem.SellIn); break; case CheckedProperty.Quality: CheckItemValueOperation(operationWay, operand, currentItem.Quality, originalItem.Quality); break; case CheckedProperty.Unknown: default: throw new ArgumentOutOfRangeException("checkedProperty"); } } }