Exemplo n.º 1
0
 def test_demanding_behaviour_buy_should_keep_player_balance_when_player_balance_when_location_already_have_a_owner(
     self, ):
     player2 = Player(behaviour=self.behaviour, balance=300)
     location = Location(cost_of_sale=150, cost_of_rent=55)
     location.owner = player2
     self.player.buy(location)
     expected = 300
     result = self.player.balance
Exemplo n.º 2
0
 def test_update_owner_should_set_player_as_location_owner_value(self):
     behaviour = Demanding()
     player = Player(behaviour=behaviour, balance=300)
     location = Location(cost_of_sale=150, cost_of_rent=50)
     location.update_owner(player)
     result = location.owner
     expected = player
     self.assertEqual(expected, result, "message")
Exemplo n.º 3
0
 def test_impulsive_behaviour_buy_should_keep_balance_attribute_when_a_property_already_have_a_owner(
     self, ):
     player2 = Player(behaviour=self.behaviour, balance=300)
     location = Location(cost_of_sale=150, cost_of_rent=150)
     location.owner = player2
     expected = 300
     self.player.buy(location)
     result = self.player.balance
     self.assertEqual(expected, result, "message")
Exemplo n.º 4
0
 def test_repr_should_return_a_string_with_player_info_and_location_cost_of_sale_and_location_cost_of_rent(
     self, ):
     behaviour = Demanding()
     player = Player(behaviour=behaviour, balance=300)
     location = Location(cost_of_sale=150, cost_of_rent=50)
     location.update_owner(player)
     expected = "300 - Demanding - 150 - 50"
     result = repr(location)
     self.assertEqual(expected, result)
Exemplo n.º 5
0
 def test_player_pay_rent_should_update_player_balance_when_location_has_owner(
     self, ):
     behaviour = Demanding()
     player = Player(behaviour=behaviour, balance=300)
     player2 = Player(behaviour=behaviour, balance=300)
     location = Location(cost_of_sale=150, cost_of_rent=50)
     location.update_owner(player2)
     player_expected_balance = 250
     player2_expected_balance = 350
     player.pay_rent(location)
     self.assertEqual(player.balance, player_expected_balance)
     self.assertEqual(player2.balance, player2_expected_balance)
Exemplo n.º 6
0
 def test_cautious_behaviour_should_keep_balance_unchanged_when_player_balance_less_location_cost_of_sale_result_lesser_than_80(
     self, ):
     location = Location(cost_of_sale=250, cost_of_rent=49)
     self.player.buy(location)
     expected = 300
     result = self.player.balance
     self.assertEqual(expected, result)
Exemplo n.º 7
0
 def test_random_behaviour_buy_should_keep_player_balance_unchanged_when_random_value_is_false(
         self, mocked_choice):
     location = Location(cost_of_sale=150, cost_of_rent=49)
     self.player.buy(location)
     expected = 300
     result = self.player.balance
     self.assertEqual(expected, result)
Exemplo n.º 8
0
 def test_demanding_behaviour_buy_should_keep_player_balance_when_location_cost_of_rent_lesser_than_50(
     self, ):
     location = Location(cost_of_sale=150, cost_of_rent=49)
     expected = 300
     self.player.buy(location)
     result = self.player.balance
     self.assertEqual(expected, result)
Exemplo n.º 9
0
 def test_demanding_behaviour_buy_should_update_player_balance_when_location_cost_of_saler_lesser_than_player_balance_and_location_cost_of_rent_greater_than_50(
     self, ):
     location = Location(cost_of_sale=150, cost_of_rent=51)
     expected = 150
     self.player.buy(location)
     result = self.player.balance
     self.assertEqual(expected, result, "message")
Exemplo n.º 10
0
 def test_impulsive_behaviour_buy_should_keep_balance_attribute_when_a_property_cost_of_sale_is_greater_than_player_balance(
     self, ):
     location = Location(cost_of_sale=150, cost_of_rent=150)
     expected = 150
     self.player.buy(location)
     result = self.player.balance
     self.assertEqual(expected, result, "message")
Exemplo n.º 11
0
 def test_impulsive_behaviour_buy_should_return_true_when_player_balance_is_greater_than_location_cost_of_sale_and_location_has_no_owner(
     self, ):
     location = Location(cost_of_sale=150, cost_of_rent=150)
     self.player.buy(location)
     result = self.player.balance
     expected_balance = 150
     self.assertEqual(expected_balance, result, "message")
Exemplo n.º 12
0
 def test_remove_owner_should_set_location_owner_value_to_none(self):
     behaviour = Demanding()
     player = Player(behaviour=behaviour, balance=300)
     location = Location(cost_of_sale=150, cost_of_rent=50)
     location.update_owner(player)
     location.remove_owner()
     self.assertIsNone(location.owner)