Esempio n. 1
0
    def test_whenMovingElement_thenElementIsRemovedFromPreviousPoisition(self):
        energy = create_autospec(Energy)
        world_elements = WorldElements({A_MONSTER})

        world_elements.move(A_MONSTER, A_DELTA_POSITION, energy)

        self.assertNotIn(A_MONSTER, world_elements)
Esempio n. 2
0
    def test_whenMovingElement_thenSquaredMagnitudeOfMovementIsRemovedFromEnergy(
            self):
        energy = create_autospec(Energy)
        world_elements = WorldElements({A_MONSTER})

        world_elements.move(A_MONSTER, A_DELTA_POSITION, energy)

        energy.remove.assert_called_once_with(A_DELTA_POSITION.magnitude()**2)
Esempio n. 3
0
    def test_whenMovingElement_thenElementIsmovedToNewPosition(self):
        energy = create_autospec(Energy)
        world_elements = WorldElements({A_MONSTER})

        world_elements.move(A_MONSTER, A_DELTA_POSITION, energy)

        expected_element = NormalMonster(A_POSITION + A_DELTA_POSITION,
                                         SOME_ENERGY, RANGE_OF_MOTION,
                                         MONSTER_NAME)
        self.assertIn(expected_element, world_elements)