Example #1
0
        public void ExampleB1()
        {
            var keypad = new Day02.KeyPad('5', false);

            Assert.AreEqual('5', keypad.Move(""));
            Assert.AreEqual('D', keypad.Move("RRDDD"));
            Assert.AreEqual('B', keypad.Move("DURRL"));
            Assert.AreEqual('3', keypad.Move("UUUUD"));
            Assert.AreEqual("5DB3", keypad.KeysPressed);
        }
Example #2
0
        public void AnswerB()
        {
            var keypad = new Day02.KeyPad('5', false);

            foreach (var move in File.ReadAllLines("Day2_input.txt"))
            {
                keypad.Move(move);
            }
            Assert.AreEqual("A7AC3", keypad.KeysPressed);
        }
Example #3
0
        public void ExampleA1()
        {
            var keypad = new Day02.KeyPad('5');
            var moves  = new List <string>
            {
                "ULL",
                "RRDDD",
                "LURDL",
                "UUUUD"
            };

            moves.ForEach(move => keypad.Move(move));
            Assert.AreEqual("1985", keypad.KeysPressed);
        }