public void ShouldMakeArrayBasedOnFieldSize(string [] input, int rank, int length) { var fieldCreator = new FieldCreator(); var lineRetriever = new LineRetriever(input); var allFields = fieldCreator.ReadFields(lineRetriever); var fieldArray = HintFieldCalculator.ConvertToArray(allFields[0]); Assert.Equal(rank, fieldArray.Rank); Assert.Equal(length, fieldArray.Length); }
public void ShouldConvertFieldToArray() { var fieldCreator = new FieldCreator(); var lineRetriever = new LineRetriever(new [] { "22", "..", "*.", "00" }); var allFields = fieldCreator.ReadFields(lineRetriever); var hintArray = HintFieldCalculator.ConvertToArray(allFields[0]); Assert.Equal(4, hintArray.Length); Assert.Equal(CellType.Empty, hintArray[0, 0]); Assert.Equal(CellType.Empty, hintArray[0, 1]); Assert.Equal(CellType.Mine, hintArray[1, 0]); Assert.Equal(CellType.Empty, hintArray[1, 1]); }