Exemplo n.º 1
0
class TestBagOLoot(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.bag = LootBag()

    def test_can_list_toys_from_bag_for_child(self):
        expected_result = 'ball'
        actual_result = self.bag.list_toys_for_child('Mikey')

        self.assertIn(expected_result, actual_result)

    def test_add_toy_to_bag(self):
        toy = "Truck"
        toy_list = self.bag.list_toys_for_child("Mikey")
        self.assertNotIn(toy, toy_list)
        self.bag.add_toy_to_bag('truck', 'Mikey')
        self.bag.list_toys_for_child("Mikey")
        self.assertIn(toy, toy_list)
Exemplo n.º 2
0
class TestLootBag(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.bag = LootBag()

    def test_can_list_toys_from_bag_for_child(self):
        expected_result = 'Transformer'
        actual_result = self.bag.list_toys_for_child('Raffy')

        self.assertIn(expected_result, actual_result)

    def test_add_toy_to_bag(self):
        bag = LootBag()
        toy = 'Transformer'
        self.assertEqual(toy, bag.add_toy_to_bag('Transformer', 'Raffy'),
                         "Toy added to bag.")
Exemplo n.º 3
0
class TestBagOLoot(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.bag = LootBag()

    def test_can_list_toys_from_bag_for_child(self):
        expected_result = "ball"
        actual_result = self.bag.list_toys_for_child("Mikey")

        self.assertIn(expected_result, actual_result)

    def test_add_toy_to_bag(self):
        bag = LootBag()
        toy = "ball"
        self.assertEqual(bag.add_toy_to_bag("ball", "Mikey"),
                         "Toy added to bag")