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); }
public void Rent_Per_Day_GetCost_WhitoutInitialize() { RentPerDay rent = new RentPerDay(); RentManager rentManager = new RentManager(); //rentManager.Initialize(rent); //Whitout Initialize //rent.DaysQuantity = 3; //Whitout set any Days. float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.IsNull(totalCostResult); }
public void Rent_Per_Day_GetCost_OneDay() { float expectedCostResult = 20; RentPerDay rent = new RentPerDay(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Day cost //rent.DaysQuantity = 3; //Whitout set any days. float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Rent_Per_Day_GetCost_ManyDays() { float expectedCostResult = 80; RentPerDay rent = new RentPerDay(); RentManager rentManager = new RentManager(); rentManager.Initialize(rent); //Initialize Rent By Day cost rent.DaysQuantity = 4; //Set rent on 4 Days float?totalCostResult = rentManager.GetTotalCostRent(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Rent_Per_Family_GetCost_5rents() { float expectedCostResult = (float)((20 + 15 + 20 + 5 + 5) * (0.7)); RentPerHour rent1 = new RentPerHour(); RentPerHour rent2 = new RentPerHour(); RentPerDay rent3 = new RentPerDay(); RentPerHour rent4 = new RentPerHour(); RentPerHour rent5 = new RentPerHour(); rent1.HoursQuantity = 4; rent2.HoursQuantity = 3; RentManager rentManager = new RentManager(); rentManager.Initialize(rent1); //Initialize Rent rentManager.Initialize(rent2); //Initialize Rent rentManager.Initialize(rent3); //Initialize Rent rentManager.Initialize(rent4); //Initialize Rent rentManager.Initialize(rent5); //Initialize Rent FamilyRent rent = new FamilyRent(); rentManager.Initialize(rent); List <Rent> rents = new List <Rent> { rent1, rent2, rent3 }; rent.AddRents(rents); rent.AddRent(rent4); rent.AddRent(rent5); float?totalCostResult = rentManager.FamilyRent_GetTotalAmount(rent); Assert.AreEqual(expectedCostResult, totalCostResult); }
public void Initialize(RentPerDay rent) { rent.Cost = 20; }