Example #1
0
        public void Rent_Per_Family_GetCost_3rents()
        {
            float expectedCostResult = (float)(160 * (0.7));

            RentPerWeek rent1 = new RentPerWeek();
            RentPerWeek rent2 = new RentPerWeek();
            RentPerDay  rent3 = new RentPerDay();

            rent3.DaysQuantity = 2;

            RentManager rentManager = new RentManager();

            rentManager.Initialize(rent1);   //Initialize Rent By Week cost
            rentManager.Initialize(rent2);   //Initialize Rent By Week cost
            rentManager.Initialize(rent3);   //Initialize Rent By Week cost

            FamilyRent rent = new FamilyRent();

            rentManager.Initialize(rent);
            List <Rent> rents = new List <Rent> {
                rent1, rent2, rent3
            };

            rent.AddRents(rents);

            /*rent.AddRent(rent1);
            *  rent.AddRent(rent2);
            *  rent.AddRent(rent3);*/

            float?totalCostResult = rentManager.FamilyRent_GetTotalAmount(rent);

            Assert.AreEqual(expectedCostResult, totalCostResult);
        }
Example #2
0
        public void Rent_Per_Week_GetCost_WhitoutInitialize()
        {
            RentPerWeek rent        = new RentPerWeek();
            RentManager rentManager = new RentManager();
            //rentManager.Initialize(rent);   //Whitout Initialize
            //rent.WeeksQuantity = 3;         //Whitout set any Weeks.
            float?totalCostResult = rentManager.GetTotalCostRent(rent);

            Assert.IsNull(totalCostResult);
        }
Example #3
0
        public void Rent_Per_Week_GetCost_ManyWeeks()
        {
            float expectedCostResult = 120;

            RentPerWeek rent        = new RentPerWeek();
            RentManager rentManager = new RentManager();

            rentManager.Initialize(rent);   //Initialize Rent By Week cost
            rent.WeeksQuantity = 2;         //Set rent on 2 weeks
            float?totalCostResult = rentManager.GetTotalCostRent(rent);

            Assert.AreEqual(expectedCostResult, totalCostResult);
        }
Example #4
0
        public void Rent_Per_Week_GetCost_OneWeek()
        {
            float expectedCostResult = 60;

            RentPerWeek rent        = new RentPerWeek();
            RentManager rentManager = new RentManager();

            rentManager.Initialize(rent);   //Initialize Rent By Week cost
            //rent.WeeksQuantity = 3;         //Whitout set any Weeks.
            float?totalCostResult = rentManager.GetTotalCostRent(rent);

            Assert.AreEqual(expectedCostResult, totalCostResult);
        }
Example #5
0
 public void Initialize(RentPerWeek rent)
 {
     rent.Cost = 60;
 }