Example #1
0
        public void RemoveRentItem(int position)
        {
            if (ValidTo.HasExpired())
            {
                throw new RentHasExpiredException();
            }

            var rentItem = _rentItems.Single(item => item.ItemPosition == position);

            _rentItems.Remove(rentItem);
        }
Example #2
0
        public void AddRentItem(RentItem item)
        {
            if (ValidTo.HasExpired())
            {
                throw new RentHasExpiredException();
            }

            if (_rentItems.Any(i => i.ItemPosition == item.ItemPosition))
            {
                throw new RentItemAlreadyExistsOnPosition();
            }
        }
Example #3
0
 public bool HasExpired() => ValidTo.HasExpired();