public void PathfindingGrid_IndexOpenSpace_ReturnsOne()
        {
            InitGrid(2, 2);
            _layer.Put(1, 1, CreateFloor());

            var result = _grid[4, 4];

            Assert.AreEqual(1, result);
        }
        public void PathPlanner_StraightLine_ReturnsCorrectPath()
        {
            _layer.Put(2, 1, CreateFloor());

            var start = new XYZ(0, 1, 0);
            var end   = new XYZ(2, 1, 0);
            var path  = _pathFinder.GetPath(start, end);

            AssertValidPath(start, end, path);
        }
        public void FacilityMap_GetFirstLayerSpace_CanGetSpace()
        {
            _sampleLayer.Put(1, 2, _sampleSpace);

            _map.Add(_sampleLayer);

            Assert.AreEqual(_sampleSpace, _map[1, 2, 0]);
        }
        public void FacilityMap_GetThirdLayerSpace_CanGetSpace()
        {
            var thirdFloor = new FacilityLayer();

            thirdFloor.Put(13, 19, _sampleSpace);

            _map.Add(_sampleLayer);
            _map.Add(_sampleLayer);
            _map.Add(thirdFloor);

            Assert.AreEqual(_sampleSpace, _map[13, 19, 2]);
        }
        private FacilityLayer CreateFacilityLayer()
        {
            var layer = new FacilityLayer(3, 3);

            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    layer.Put(x, y, CreateFloor());
                }
            }
            return(layer);
        }
예제 #6
0
        public void FacilityLayer_PutFacilitySpaceWithXY_CanGetSpace()
        {
            _layer.Put(new XY(5, 6), _sampleSpace);

            Assert.AreEqual(_sampleSpace, _layer[5, 6]);
        }
 private void PutFloor(int x, int y)
 {
     _layer.Put(new XY(x, y), _floorSpace);
 }