public void GetNextBusProduct_GivenValidTimestampAndBusses_ReturnsExpectedResult()
        {
            var sut    = new BusScheduler(new RecordFormatter(null));
            var result = sut.GetNextBusProduct(939, "7,13,x,x,59,x,31,19");

            Assert.Equal(295, result);
        }
Пример #2
0
        /// <summary>
        /// TuringBusses.Cmd entry point
        /// </summary>
        /// <param name="args">Command line arguments (not used)</param>
        static void Main(string[] args)
        {
            var filePath  = "./input";
            var reader    = new FileReader();
            var formatter = new RecordFormatter(reader);
            var records   = formatter.FormatFile(filePath, "\n", true);

            var timeStamp = int.Parse(records.First());

            var scheduler = new BusScheduler(formatter);

            var product = scheduler.GetNextBusProduct(timeStamp, records.Skip(1).First());

            Console.WriteLine(product);

            var timeStamp2 = scheduler.WinContest(records.Skip(1).First());

            Console.WriteLine(timeStamp2);
        }