Пример #1
0
 public void ShouldReturnCorrectSeatFFFBBBFRRR()
 {
     using (AOC aoc = new AOC())
     {
         //[44,5] == row 44 column 5
         int[] seat = new int[] { 14, 7, 119 };
         Assert.Equal(seat, aoc.Decode("FFFBBBFRRR"));
     }
 }
Пример #2
0
 public void ShouldReturnCorrectSeatBBFFBBFRLL()
 {
     using (AOC aoc = new AOC())
     {
         //[44,5] == row 44 column 5
         int[] seat = new int[] { 102, 4, 820 };
         Assert.Equal(seat, aoc.Decode("BBFFBBFRLL"));
     }
 }
Пример #3
0
 public void ShouldReturnCorrectSeatFBFBBFFRLR()
 {
     using (AOC aoc = new AOC())
     {
         //[44,5] == row 44 column 5
         int[] seat = new int[] { 44, 5, 357 };
         Assert.Equal(seat, aoc.Decode("FBFBBFFRLR"));
     }
 }
Пример #4
0
        public void ShouldCalculateHighestSeatID()
        {
            AOC aoc = new AOC();

            foreach (string s in input)
            {
                seatids.Add(aoc.Decode(s)[2]);
            }
            Assert.Equal(926, seatids.Max());

            //used this txtfile to sort the missing value.
            // using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"./WriteLines2.txt"))
            // {
            //     foreach (int line in seatids)
            //     {
            //             file.WriteLine(""+line);

            //     }
            // }
        }
Пример #5
0
 public void ShouldFindMissingSeatNumber()
 {
     using (AOC aoc = new AOC())
     {
         foreach (string s in input)
         {
             seatids.Add(aoc.Decode(s)[2]);
         }
         var ascendingOrder = seatids.OrderBy(i => i);
         int count          = 80; // 80 being the lowest id possible
         foreach (var value in ascendingOrder)
         {
             if (count != value)
             {
                 //Console.WriteLine($"Found missing {count}");
                 break;
             }
             count++;
         }
         Assert.Equal(657, count);
     }
 }