Exemplo n.º 1
0
        public void GridShouldBeAbleToReportUnusedNumbers()
        {
            var arrayInput = new int[3, 3] {
                { 2, 3, 4 }, { 9, 0, 5 }, { 0, 7, 0 }
            };
            var grid = new DelacorteGrid(arrayInput);

            grid.IdentifyUnusedValues().ShouldBeEquivalentTo(new[] { 1, 6, 8 });
        }
Exemplo n.º 2
0
        public void GridsToStringIsAccurate()
        {
            var arrayInput = new int[3, 2] {
                { 6, 4 }, { 5, 1 }, { 2, 3 }
            };
            var grid = new DelacorteGrid(arrayInput);

            grid.ToString().Should().Be("( 6, 4),( 5, 1),( 2, 3);");
        }
Exemplo n.º 3
0
        public void FilledGridShouldReportNoMissingNumbers()
        {
            var arrayInput = new int[3, 3] {
                { 2, 3, 4 }, { 9, DelacorteGrid.UNSPECIFIED, 5 }, { DelacorteGrid.UNSPECIFIED, 7, DelacorteGrid.UNSPECIFIED }
            };
            var providedPermutation = new[] { 1, 6, 8 };
            var filledGrid          = new DelacorteGrid(arrayInput).FillToCreateNewGrid(providedPermutation);

            filledGrid.IdentifyUnusedValues().ShouldBeEquivalentTo(new int[] { });
        }
Exemplo n.º 4
0
        public void GridListConstructorShouldWorkOnRectangularGrids()
        {
            var grid = new DelacorteGrid(3, 2, new List <int> {
                2, 3, 4, 9, 0, 5
            });

            grid.Array.Should().Equal(new int[3, 2] {
                { 2, 3 }, { 4, 9 }, { 0, 5 }
            });
        }
Exemplo n.º 5
0
        public void GridListConstructorShouldWorkOnSquareGrids()
        {
            var grid = new DelacorteGrid(3, 3, new List <int> {
                2, 3, 4, 9, 0, 5, 0, 7, 0
            });

            grid.Array.Should().Equal(new int[3, 3] {
                { 2, 3, 4 }, { 9, 0, 5 }, { 0, 7, 0 }
            });
        }
Exemplo n.º 6
0
        public void GridFillShouldInsertNumbersInTheAppropriateOrder()
        {
            var arrayInput = new int[3, 3] {
                { 2, 3, 4 }, { 9, DelacorteGrid.UNSPECIFIED, 5 }, { DelacorteGrid.UNSPECIFIED, 7, DelacorteGrid.UNSPECIFIED }
            };
            var providedPermutation = new[] { 8, 1, 6 };
            var filledGrid          = new DelacorteGrid(arrayInput).FillToCreateNewGrid(providedPermutation);

            filledGrid.Array.Should().Equal(new int[3, 3] {
                { 2, 3, 4 }, { 9, 8, 5 }, { 1, 7, 6 }
            });
        }