static void Main(string[] args) { Console.WriteLine("Start..."); var fieldString = new List<string>(); string input; while ((input = Console.ReadLine()) != "c") { fieldString.Add(input); } var field = string.Join(Environment.NewLine, fieldString); var builder = new MineFieldsBuilder(); var result = builder.Build(field); Console.Write(result); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Start..."); var fieldString = new List <string>(); string input; while ((input = Console.ReadLine()) != "c") { fieldString.Add(input); } var field = string.Join(Environment.NewLine, fieldString); var builder = new MineFieldsBuilder(); var result = builder.Build(field); Console.Write(result); Console.ReadLine(); }
public void WhenInputIsNull_ResultIsNull() { var mineFields = MineFieldsBuilder.Build(null); Assert.IsNull(mineFields); }
public void WhenThereIs3LineOf4CharAndSecondCharIsAMine_ResultIsCorrect() { var mineFields = MineFieldsBuilder.Build(CreateMultiLinesField(".*..", "....", "....")); Assert.AreEqual(CreateMultiLinesField("1*10", "1110", "0000"), mineFields); }
public void WhenThereIs1LineOf4CharAndLastCharIsAMine_ResultIsCorrect() { var mineFields = MineFieldsBuilder.Build("...*"); Assert.AreEqual("001*", mineFields); }
public void WhenThereIs2LineOf4CharAndFirstCharIsAMine_ResultIsCorrect() { var mineFields = MineFieldsBuilder.Build(CreateMultiLinesField("*...", "....")); Assert.AreEqual(CreateMultiLinesField("*100", "1100"), mineFields); }
public void WhenThereIs2LinesOf4NoMine_ResultIs2LinesOf4Zeros() { var mineFields = MineFieldsBuilder.Build(CreateMultiLinesField("....", "....")); Assert.AreEqual(CreateMultiLinesField("0000", "0000"), mineFields); }
public void WhenThereIs1LineOf4CharAndFirstCharIsAMine_ResultIsCorrect() { var mineFields = MineFieldsBuilder.Build("*..."); Assert.AreEqual("*100", mineFields); }
public void WhenThereIs10Mine_ResultIs10Mines() { var mineFields = MineFieldsBuilder.Build("**********"); Assert.AreEqual("**********", mineFields); }
public void WhenThereIs10NoMine_ResultIs10Zeros() { var mineFields = MineFieldsBuilder.Build(".........."); Assert.AreEqual("0000000000", mineFields); }
public void WhenInputIsEmpty_ResultIsEmpty() { var mineFields = MineFieldsBuilder.Build(""); Assert.AreEqual("", mineFields); }
public void WhenThereIs2LineOf4CharAnd2Mines_ResultIsCorrect() { var mineFields = MineFieldsBuilder.Build(CreateMultiLinesField("...*", "**..")); Assert.AreEqual(CreateMultiLinesField("222*", "**21"), mineFields); }
public void WhenThereIs1LineOf4CharAnd2CharIsAMine_ResultIsCorrect() { var mineFields = MineFieldsBuilder.Build(CreateMultiLinesField(".**.")); Assert.AreEqual(CreateMultiLinesField("1**1"), mineFields); }