Exemplo n.º 1
0
        /// <summary>
        /// Calculate total price of a board for a given state, board size, and for the given number of days.
        /// </summary>
        public decimal GetPrice()
        {
            decimal total = 0m;

            Discount  = 0m;
            DailyRate = new UnitPriceDAL().GetUnitPrice(PropertyAddress.State, BoardSize);
            total     = DailyRate * NumberOfDays;
            if (NumberOfDays > 10)
            {
                if (PropertyAddress.State == "NSW")
                {
                    Discount     = total * DiscountRateNSW / 100;
                    DiscountRate = DiscountRateNSW;
                }
                else
                {
                    Discount     = total * DiscountRateOther / 100;
                    DiscountRate = DiscountRateOther;
                }
            }

            Amount = Math.Round(total - Discount, 2);

            return(Amount);
        }
        public void UnitPriceByStateBoardSize()
        {
            decimal price = new UnitPriceDAL().GetUnitPrice("NSW", BoardSize.Small);

            Assert.AreEqual(50, price);
        }
        public void AllUnitPrices()
        {
            var collection = new UnitPriceDAL().GetAllPrices();

            Assert.AreEqual(10, collection.Count);
        }