public void WhenDamageIsApplied_DamageIsSubstractedFromHealthOk()
        {
            var unitStats = new UnitStatsConfigBuilder().WithHealthPoints(100).Build();
            var unit      = new TestUnitBuilder().WithStats(unitStats).Build();

            var unitHealth        = TestMocksFactory.GetMockUnitHealth(unit);
            var damage            = 1;
            var damageUnitCommand = new DamageUnitCommand(unitHealth, damage);

            var expectedHealth = unit.HealthPoints.Current - damage;

            damageUnitCommand.Execute();

            Assert.AreEqual(unit.HealthPoints.Current, expectedHealth);
        }
示例#2
0
        public static CharacterUnitController GetMockCharacterController(Cell spawnCell, IGrid grid)
        {
            var gameobject = new GameObject();

            gameobject.AddComponent <UnitSpriteController>();
            gameobject.AddComponent <UnitCanvasView>();
            gameobject.AddComponent <UnitFxController>();
            var unitController = gameobject.AddComponent <CharacterUnitController>();

            var unit = new TestUnitBuilder().Build();

            unit.CurrentCell = spawnCell;

            unitController.InjectDependencies(
                unit,
                GetMockTurnDealer(),
                grid,
                GetMockUnitHealth(unit),
                GetMockUnitMovement(unit, grid),
                null
                );

            return(unitController);
        }