示例#1
0
        public void AddQuantityNegativeValueShouldDecrement()
        {
            var lineItem = new SalesLineItem(new Product("A", price: 1.0m), quantity: 1);

            lineItem.AddQuantity(-1);

            Assert.That(lineItem.Quantity, Is.EqualTo(0));
        }
示例#2
0
        public void AddQuantityNegativeValueThatDecrementsQuantityToNegativeValueShouldThrowException()
        {
            var lineItem = new SalesLineItem(new Product("A", price: 1.0m), quantity: 0);

            Assert.Throws <ArgumentOutOfRangeException>(() => lineItem.AddQuantity(-1));
        }