コード例 #1
0
        public void ReadFileInput_UnitTest(string filePath, string expectedProbeAOutcome, string expectedProbeBOutcome)
        {
            var stringReader = new StringReader(filePath + '\n');

            Console.SetIn(stringReader);

            var facade = new FileInputFacade(_field);

            facade.ReadInput();

            _field.Probes.Count.ShouldBe(2);
            _field.Probes[0].GetPosition().ShouldBe(expectedProbeAOutcome);
            _field.Probes[1].GetPosition().ShouldBe(expectedProbeBOutcome);
        }
コード例 #2
0
        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();
            }
        }