Exemplo n.º 1
0
        private static void Day4()
        {
            int sumOfSectorIds = 0;
            var reader         = new StreamReader(@"..\..\Day4\input.txt");

            Day4.Day4 d4p1;

            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();

                d4p1 = new Day4.Day4(line);

                if (d4p1.IsRealRoom())
                {
                    sumOfSectorIds += d4p1.GetSectorId();
                }

                if (d4p1.Decrypt().StartsWith("north"))
                {
                    Console.WriteLine($"{d4p1.Decrypt()} -> {d4p1.GetSectorId()}");
                }
            }

            Console.WriteLine($"Puzzle 1: {sumOfSectorIds}");
        }
Exemplo n.º 2
0
        public void DecryptReturnsCorrectvalue(string name, string expected)
        {
            var sut = new AdventOfCode2016.Day4.Day4(name);

            var actual = sut.Decrypt();

            Assert.Equal(expected, actual);
        }
Exemplo n.º 3
0
        public void GetNamePartReturnsCorrectValue(string name, string expected)
        {
            var sut = new AdventOfCode2016.Day4.Day4(name);

            var actual = sut.GetNamePart();

            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
        public void IsRealRoomReturnsCorrectValue(string name, bool expected)
        {
            var sut = new AdventOfCode2016.Day4.Day4(name);

            var actual = sut.IsRealRoom();

            Assert.Equal(expected, actual);
        }
Exemplo n.º 5
0
        public void GetSectorIdReturnsCorrectValue(string name, int expected)
        {
            var sut = new AdventOfCode2016.Day4.Day4(name);

            var actual = sut.GetSectorId();

            Assert.Equal(expected, actual);
        }
Exemplo n.º 6
0
        public void GetChecksumReturnsCorrectValue(string name, string expected)
        {
            var sut = new AdventOfCode2016.Day4.Day4(name);

            var actual = sut.CalculateChecksum();

            Assert.Equal(expected, actual);
        }