示例#1
0
 def test_regular_vehicle_multiple_pass_within_an_hour_not_first_interval(self):
     v = Vehicle('private')
     dates = ["2017-09-15 07:15", "2017-09-15 08:30", "2017-09-15 08:45"]
     toll = toll_calculator.calculate_toll(v, dates)
     self.assertEqual(toll, 26)
示例#2
0
 def test_regular_vehicle_multiple_pass_within_one_hour_change_rush_hour_edge_case(self):
     v = Vehicle('private')
     dates = ["2017-09-15 07:15", "2017-09-15 08:15", "2017-09-15 18:15", "2017-09-15 20:15"]
     toll = toll_calculator.calculate_toll(v, dates)
     self.assertEqual(toll, 26)
示例#3
0
 def test_regular_vehicle_multiple_pass_different_days(self):
     v = Vehicle('private')
     dates = ["2017-09-15 07:15", "2017-09-16 07:45"]
     with self.assertRaises(toll_calculator.DifferentDaysException):
         toll_calculator.calculate_toll(v, dates)
示例#4
0
 def test_regular_vehicle_cant_pass_twice_same_time(self):
     v = Vehicle('private')
     dates = ["2017-09-15 07:15", "2017-09-15 07:15", "2017-09-15 07:45"]
     with self.assertRaises(toll_calculator.PassedTollTwiceSameTimeException):
         toll_calculator.calculate_toll(v, dates)
示例#5
0
 def test_regular_vehicle_multiple_pass_reached_max(self):
     v = Vehicle('private')
     dates = ["2017-09-15 07:15", "2017-09-15 08:30", "2017-09-15 15:30", "2017-09-15 16:45"]
     toll = toll_calculator.calculate_toll(v, dates)
     self.assertEqual(toll, 60)
示例#6
0
 def test_regular_vehicle_multiple_pass(self):
     v = Vehicle('private')
     dates = ["2017-09-15 07:15", "2017-09-15 08:30", "2017-09-15 18:15", "2017-09-15 20:15"]
     toll = toll_calculator.calculate_toll(v, dates)
     self.assertEqual(toll, 34)
示例#7
0
 def test_regular_vehicle_single_pass_rush_hour(self):
     v = Vehicle('private')
     toll = toll_calculator.calculate_toll(v, ["2017-09-15 07:15"])
     self.assertEqual(toll, 18)
示例#8
0
 def test_regular_vehicle_single_pass_sunday(self):
     v = Vehicle('private')
     toll = toll_calculator.calculate_toll(v, ["2017-09-17 07:15"])
     self.assertEqual(toll, 0)
示例#9
0
 def test_toll_free_vehicle(self):
     v = Vehicle('diplomat')
     toll = toll_calculator.calculate_toll(v, ["2017-09-15 16:59"])
     self.assertEqual(toll, 0)