Ejemplo n.º 1
0
        public void Day06ParseCommandTest()
        {
            const string stringCommand = "toggle 14,9 through 29,16";
            Command      command       = Program06.ParseCommand(stringCommand);

            Assert.Equal(command.Instruction, Instruction.Toggle);
            Assert.Equal(command.FromX, 14);
            Assert.Equal(command.FromY, 9);
            Assert.Equal(command.ToX, 29);
            Assert.Equal(command.ToY, 16);
        }
Ejemplo n.º 2
0
        public void Day06PartOne()
        {
            bool[,] lightsArray = new bool[10, 10];
            const string stringCommand = "turn on 0,0 through 2,2";
            Command      command       = Program06.ParseCommand(stringCommand);

            Program06.ExecuteCommand(command, ref lightsArray);

            Assert.Equal(lightsArray[0, 0], true);
            Assert.Equal(lightsArray[0, 1], true);
            Assert.Equal(lightsArray[0, 3], false);
            Assert.Equal(lightsArray[1, 0], true);
            Assert.Equal(lightsArray[1, 1], true);
            Assert.Equal(lightsArray[2, 2], true);
            Assert.Equal(lightsArray[3, 0], false);
            Assert.Equal(lightsArray[0, 3], false);
            Assert.Equal(lightsArray[2, 3], false);
            Assert.Equal(lightsArray[3, 2], false);
        }