def test_GenerateBill_with_valid_Customer_detail_should_return_zero_as_tax_if_requestvalue_basevalue_priorityfare_are_zero(self): customer = customerBillDetail(customerType.Regular,"Tom",0,0) customer.baseFare =0 customer.PriorityRequestFare =0 customer.discount =0 TaxCalculator(ICalculator).GenerateBill(customer) self.assertEqual(customer.tax,0.0)
def test_GenerateBill_with_valid_Customer_detail_should_return_the_discountfare_for_request(self): customer = customerBillDetail(customerType.Regular,"Tom",5,5) customer.baseFare =50.0 DiscountCalculator(ICalculator).GenerateBill(customer) self.assertIsNotNone(customer.discountPercentage) self.assertIsNotNone(customer.discount) self.assertEqual(customer.discountPercentage,10.0) self.assertEqual(customer.discount,5.0)
def test_GenerateBill_with_valid_Customer_detail_should_return_the_taxfare_for_request(self): customer = customerBillDetail(customerType.Regular,"Tom",5,5) customer.baseFare =50.0 customer.PriorityRequestFare = 25.0 customer.discount =7.5 TaxCalculator(ICalculator).GenerateBill(customer) self.assertIsNotNone(customer.tax) self.assertEqual(customer.tax,6.75)
def test_GenerateBill_with_valid_Customer_detail_should_return_zero_as_discountfare_if_requestvalue_is_zero(self): customer = customerBillDetail(customerType.Regular,"Tom",0,0) customer.baseFare =0 DiscountCalculator(ICalculator).GenerateBill(customer) self.assertIsNotNone(customer.discountPercentage) self.assertIsNotNone(customer.discount) self.assertEqual(customer.discountPercentage,10.0) self.assertEqual(customer.discount,0.0)
def test_calculateTotal_when_given_valid_customer_detail_should_calculate_total_bill_amount(self): customerBill = customerBillDetail(customerType.Platinum,"Tom",5,5) customerBill.baseFare = 100.0 customerBill.PriorityRequestFare=0.0 customerBill.discountPercentage =10 customerBill.discount =10.0 customerBill.tax = 9.0 customerBill.calculateTotal() self.assertIsNotNone(customerBill.total) self.assertEqual(customerBill.total,99)
def test_GenerateMonthlyBill_when_given_valid_customer_detail_should_generate_monthlybill_for_given_Customer(self): customerBillGenerator =CustomerBillGenerator() customerDetailmock = customerBillDetail(customerType.Platinum,"Tom",5,5) customerBillGenerator.GenerateMonthlyBill(customerDetailmock) self.assertIsNotNone(customerDetailmock.name) self.assertEqual(customerDetailmock.name,"Tom") self.assertIsNotNone(customerDetailmock.discount) self.assertEqual(customerDetailmock.discount,5.0) self.assertIsNotNone(customerDetailmock.discountPercentage) self.assertEqual(customerDetailmock.discountPercentage,10.0) self.assertIsNotNone(customerDetailmock.total) self.assertEqual(customerDetailmock.total,49.5) self.assertIsNotNone(customerDetailmock.totalNumberofPriorityRequests) self.assertEqual(customerDetailmock.totalNumberofPriorityRequests,5) self.assertIsNotNone(customerDetailmock.totalNumberofRequests) self.assertEqual(customerDetailmock.totalNumberofRequests,5) self.assertIsNotNone(customerDetailmock.tax) self.assertEqual(customerDetailmock.tax,4.5) self.assertIsNotNone(customerDetailmock.PriorityRequestFare) self.assertEqual(customerDetailmock.PriorityRequestFare,0)
def test_GenerateBill_with_valid_Customer_detail_should_return_zero_as_basrefare_if_requestvalue_is_zero(self): customer = customerBillDetail(customerType.Regular,"Tom",0,5) BaseFareCalculator().GenerateBill(customer) self.assertIsNotNone(customer.baseFare) self.assertEqual(customer.baseFare,0.0)
def test_GenerateBill_with_valid_Customer_detail_should_return_the_basrefare_for_request(self): customer = customerBillDetail(customerType.Regular,"Tom",5,5) BaseFareCalculator().GenerateBill(customer) self.assertIsNotNone(customer.baseFare) self.assertEqual(customer.baseFare,50.0)
def test_GenerateBill_with_valid_Customer_detail_should_return_zero_as_tax_if_priorityrequest_is_zero(self): customer = customerBillDetail(customerType.Regular,"Tom",0,0) PriorityFareCalculator(ICalculator).GenerateBill(customer) self.assertEqual(customer.PriorityRequestFare,0.0)
def test_GenerateBill_with_valid_Customer_detail_should_return_the_priorityfare_for_request(self): customer = customerBillDetail(customerType.Regular,"Tom",5,5) PriorityFareCalculator(ICalculator).GenerateBill(customer) self.assertIsNotNone(customer.PriorityRequestFare) self.assertEqual(customer.PriorityRequestFare,25)