public void PlayerEnteringTrap_RecudesHealthByOne() { Trap trap = new Trap(); ICharacterMover characterMover = Substitute.For <ICharacterMover>(); trap.HandleCharacterEntered(characterMover); Debug.Log("health: " + characterMover.Health); Assert.AreEqual(-1, characterMover.Health); }
public void TestCharacterEntered() { Trap trap = new Trap(); ICharacterMover characterMover = Substitute.For <ICharacterMover>(); trap.HandleCharacterEntered(characterMover); Assert.AreEqual(-1, characterMover.Health); }
public void EnttiyEntering_TargetedTrap_ChangesHealth(EntityType entityType, TrapTargetType trapTargetType, int expectedHealthChange) { //Arrange var trap = new Trap(); var player = Substitute.For <IEntity>(); player.entityType.Returns(entityType); var startingHealth = player.health; //Act trap.HandleCharacterEntered(player, trapTargetType); //Assert Assert.AreEqual(expectedHealthChange, player.health - startingHealth); }
private void OnTriggerEnter(Collider other) { var characterMover = other.GetComponent <IEntity>(); _trap.HandleCharacterEntered(characterMover, trapTargetType); }
private void OnTriggerEnter(Collider other) { var characterMover = other.GetComponent <ICharacterMover>(); trap.HandleCharacterEntered(characterMover); }