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 }); }
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);"); }
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[] { }); }
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 } }); }
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 } }); }
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 } }); }