Пример #1
0
        public void TestGetBusIdsSorted()
        {
            List <int> busList      = ShuttleSearcher.GetBusList(this.testData);
            List <int> expectedList = busList;

            expectedList.Sort();
            Assert.AreEqual(expectedList, busList);
        }
Пример #2
0
        public void TestGetBusIds()
        {
            var expectedBusList = new List <int> {
                7, 13, 19, 31, 59
            };
            List <int> busList = ShuttleSearcher.GetBusList(this.testData);

            Assert.AreEqual(5, busList.Count);
            Assert.AreEqual(expectedBusList, busList);
        }
Пример #3
0
        public void TestEarliestDeparture()
        {
            var localTestData  = this.testData;
            int startTimestamp = int.Parse(localTestData[0]);
            var busList        = ShuttleSearcher.GetBusList(localTestData);

            (int departure, int waitTime, int busId) = ShuttleSearcher.EarliestDeparture(startTimestamp, busList);
            Assert.AreEqual(5, waitTime);
            Assert.AreEqual(944, departure);
            Assert.AreEqual(59, busId);
        }
Пример #4
0
        public void FindAnswerDayThirteenPuzzleOne()
        {
            var localTestData  = this.inputData;
            int startTimestamp = int.Parse(localTestData[0]);
            var busList        = ShuttleSearcher.GetBusList(localTestData);

            (int departure, int waitTime, int busId) = ShuttleSearcher.EarliestDeparture(startTimestamp, busList);
            Assert.AreEqual(296, waitTime * busId);
            Assert.AreEqual(8, waitTime);
            Assert.AreEqual(1000517, departure);
            Assert.AreEqual(37, busId);
        }
Пример #5
0
        public void TestNextDeparture(int startTimestamp, int busId, int expectedDeparture)
        {
            int departure = ShuttleSearcher.NextDeparture(startTimestamp, busId);

            Assert.AreEqual(expectedDeparture, departure);
        }
Пример #6
0
 public void Setup()
 {
     this.testData  = ShuttleSearcher.ReadFileAsArray(FilePathTestData);
     this.inputData = ShuttleSearcher.ReadFileAsArray(FilePathInputData);
 }