public void ReadInlineInput_UnitTest(string dimensionsString, string probeA, string probeACommands, string probeB, string probeBCommands, string expectedProbeAOutcome, string expectedProbeBOutcome) { var stringReader = new StringReader(dimensionsString + '\n' + probeA + '\n' + probeACommands + '\n' + probeB + '\n' + probeBCommands + "\nend"); Console.SetIn(stringReader); var facade = new InlineInputFacade(_field); facade.ReadInput(); _field.Probes.Count.ShouldBe(2); _field.Probes[0].GetPosition().ShouldBe(expectedProbeAOutcome); _field.Probes[1].GetPosition().ShouldBe(expectedProbeBOutcome); }
public static void Main(string[] args) { var serviceProvider = new ServiceCollection(); var field = new Field(); var inlineInputFacade = new InlineInputFacade(field); var fileInputFacade = new FileInputFacade(field); serviceProvider.AddSingleton(field); Console.WriteLine("> File or inline input?\n 1- File \n 2- Inline"); var readType = Console.ReadLine(); if (readType.Equals("1")) { fileInputFacade.ReadInput(); } else if (readType.Equals("2")) { inlineInputFacade.ReadInput(); } }