Exemple #1
0
        public void TestGetBusIdsSorted()
        {
            List <int> busList      = ShuttleSearcher.GetBusList(this.testData);
            List <int> expectedList = busList;

            expectedList.Sort();
            Assert.AreEqual(expectedList, busList);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #5
0
        public void TestNextDeparture(int startTimestamp, int busId, int expectedDeparture)
        {
            int departure = ShuttleSearcher.NextDeparture(startTimestamp, busId);

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