Exemple #1
0
        public void WhenCoordinateIsWithinCoordinateRange_ReturnTrue()
        {
            var coords1 = TestMocksFactory.GetCellCoordinates(0, 0);
            var coords2 = TestMocksFactory.GetCellCoordinates(2, 0);
            var range   = 2;

            var isWithinRange = coords1.AreCoordinatesInRange(coords2, range);

            Assert.IsTrue(isWithinRange);
        }
Exemple #2
0
        public void WhenCoordinateIsNotWithinCoordinateRange_ReturnFalse()
        {
            var coords1 = TestMocksFactory.GetCellCoordinates(3, 3);
            var coords2 = TestMocksFactory.GetCellCoordinates(2, 2);
            var range   = 1;

            var isWithinRange = coords1.AreCoordinatesInRange(coords2, range);

            Assert.IsFalse(isWithinRange);
        }
Exemple #3
0
        public void WhenAnUnitIsOnACell_AndAskingIfTheCellIsFree_ReturnFalse()
        {
            var grid          = TestMocksFactory.GetMockGrid();
            var unitSpawnCell = TestMocksFactory.GetMockCell(
                0,
                TestMocksFactory.GetCellCoordinates(0, 0),
                new int[0]
                );
            var unitController = TestMocksFactory.GetMockCharacterController(unitSpawnCell, grid);

            grid.AddCharacter(unitController);

            var isCellFree = grid.IsCellFree(unitController.GetCurrentCellId());

            Assert.IsFalse(isCellFree);
        }