Ejemplo n.º 1
0
    def test_that_only_full_hour_rates_are_calculated(self):
        babysitter = Babysitter("6:30PM", "2:45AM", "c")
        self.assertEqual(babysitter.calculate_rate(), 138)

        babysitter = Babysitter("6:30PM", "2:30AM", "c")
        self.assertEqual(babysitter.calculate_rate(), 138)

        babysitter = Babysitter("6:30PM", "1:45AM", "c")
        self.assertEqual(babysitter.calculate_rate(), 123)
Ejemplo n.º 2
0
    def test_that_the_correct_rate_is_calculated_when_family_C_is_selected(
            self):
        babysitter = Babysitter("6:00PM", "8:00PM", "c")
        self.assertEqual(babysitter.calculate_rate(), 42)

        babysitter = Babysitter("6:00PM", "11:00PM", "c")
        self.assertEqual(babysitter.calculate_rate(), 93)

        babysitter = Babysitter("6:00PM", "2:00AM", "c")
        self.assertEqual(babysitter.calculate_rate(), 138)
Ejemplo n.º 3
0
    def test_that_the_correct_rate_is_calculated_when_family_B_is_selected(
            self):
        babysitter = Babysitter("7:00PM", "9:00PM", "b")
        self.assertEqual(babysitter.calculate_rate(), 24)

        babysitter = Babysitter("7:00PM", "11:00PM", "b")
        self.assertEqual(babysitter.calculate_rate(), 44)

        babysitter = Babysitter("7:00PM", "2:00AM", "b")
        self.assertEqual(babysitter.calculate_rate(), 84)
Ejemplo n.º 4
0
    def test_that_the_correct_rate_is_calculated_when_family_A_is_selected(
            self):
        babysitter = Babysitter("7:00PM", "11:00PM", "a")
        self.assertEqual(babysitter.calculate_rate(), 60)

        babysitter = Babysitter("7:00PM", "2:00AM", "a")
        self.assertEqual(babysitter.calculate_rate(), 120)

        babysitter = Babysitter("7:00PM", "10:00PM", "a")
        self.assertEqual(babysitter.calculate_rate(), 45)
Ejemplo n.º 5
0
    def test_that_rates_are_only_calaculated_if_inputs_are_valid(self):
        babysitter = Babysitter("6:30PM", "1:45AM", "c")
        self.assertEqual(babysitter.calculate_rate(), 123)

        babysitter = Babysitter("4:30PM", "1:45AM", "c")
        self.assertEqual(babysitter.calculate_rate(), 0)

        babysitter = Babysitter("6:30PM", "4:55AM", "a")
        self.assertEqual(babysitter.calculate_rate(), 0)

        babysitter = Babysitter("6:30PM", "1:45AM", "s")
        self.assertEqual(babysitter.calculate_rate(), 0)

        babysitter = Babysitter("1:00AM", "11:00PM", "a")
        self.assertEqual(babysitter.calculate_rate(), 0)