コード例 #1
0
        public void GridToLinearDiagonalNWSEStrategy_NxNGrid_ReversedValueReturnsBottomRightToTopLeftString(string gridSource, string expected)
        {
            //arrange
            IGridManager gridManager = new GridManager(_testUtilities.StringToGrid(gridSource));

            //act
            var         gridToLinearStrategy = new GridToLinearDiagonalNWSEStrategy(gridManager);
            ILinearView linearView           = gridToLinearStrategy.GridToLinear();

            //assert
            Assert.True(expected == linearView.ReversedValue);
        }
コード例 #2
0
        public void GridToLinearDiagonalNWSEStrategy_NxNStringGrid_ReturnsReversedIndexToGridDictionary()
        {
            //arrange
            string[,] grid =
            {
                { "A", "B" },
                { "C", "D" }
            };
            IGridManager gridManager = new GridManager(grid);

            var expected = new Dictionary <int, Point>()
            {
                { 0, new Point(0, 1) }, { 1, new Point(1, 1) }, { 2, new Point(0, 0) }, { 3, new Point(1, 0) }
            };

            //act
            var         gridToLinearStrategy = new GridToLinearDiagonalNWSEStrategy(gridManager);
            ILinearView linearView           = gridToLinearStrategy.GridToLinear();

            //assert
            Assert.Equal(expected, linearView.ReversedIndexToGridPosition);
        }