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")); } }
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")); } }
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")); } }
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); // } // } }
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); } }