Пример #1
0
        private void TestSingleRental(IBillable rental)
        {
            var invoice = new Invoice();

            invoice.AddItem(rental);
            Assert.AreEqual(1, invoice.ItemCount);
            Assert.AreEqual(rental.UnitPrice * rental.Units, invoice.TotalPrice);
        }
Пример #2
0
        public double Charge(IBillable employee, int days)
        {
            int result = employee.Rate * days;

            if (employee.HasSpecialSkill())
            {
                return(result * 1.05);
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// Adds a new item.
        /// </summary>
        /// <param name="item">The item to add.</param>
        public void AddItem(IBillable item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            Items.Add(item);
            SubTotalPrice += item.TotalPrice;
        }
Пример #4
0
 public void Remove(IBillable item)
 {
     this.items.Remove(item);
 }
Пример #5
0
 public void Add(IBillable item)
 {
     this.items.Add(item);
 }