Пример #1
0
 def testBlow(self):
     explosion = Explosion(1.5)
     blowingObject = StubBlowingObject()
     blowingObject.setPosition(1.0, 0.0)
     explosion.setBlowingObject(blowingObject)
     explosion.setVolume(ExplosionVolume_Hight)
     self.assertFalse(blowingObject.blowCall)
     explosion.blow()
     self.assertTrue(explosion.isBlowing())
     self.assertTrue(blowingObject.blowCall)
     self.assertEquals((0.0, ExplosionVolume_Hight), blowingObject.blowVector)
     self.assertEquals((1.5, 1.0), blowingObject.blowPosition)
Пример #2
0
 def testMoveBowingExplosion(self):
     explosion = Explosion(2)
     explosion.setMovingStrategy(StubExplosionMovingStrategy())
     explosion.setBlowingObject(StubBlowingObject())
     explosion.blow()
     self.assertRaises(ExplosionError, lambda: explosion.move(1))
Пример #3
0
 def testSetVolumeOnBlowingExplosion(self):
     explosion = Explosion(2)
     explosion.setBlowingObject(StubBlowingObject())
     explosion.blow()
     self.assertRaises(ExplosionError, lambda: explosion.setVolume(ExplosionVolume_Normal))
Пример #4
0
 def testTwiceBlow(self):
     explosion = Explosion(2)
     explosion.setBlowingObject(StubBlowingObject())
     explosion.blow()
     self.assertRaises(ExplosionError, lambda: explosion.blow())