コード例 #1
0
        public void Get_Firewall_Dictionnary()
        {
            var lines            = reader.GetContentByLine("Day13ExFile");
            var layerDictionnary = advent.GetLayers(lines);

            Check.That(layerDictionnary.Count).Equals(lines.Count);
        }
コード例 #2
0
        public void Get_Number_Group()
        {
            var reader = new ReadFile();
            var lines  = reader.GetContentByLine("Day12ExFile");

            var nodes       = advent.GetNodes(lines);
            var numberGroup = advent.GetNumberGroup(nodes, 0);

            Check.That(numberGroup).Equals(2);
        }
コード例 #3
0
        public void Get_All_Programs_On_Zero_Group()
        {
            var reader = new ReadFile();
            var lines  = reader.GetContentByLine("Day12ExFile");

            var nodes           = advent.GetNodes(lines);
            var nodeInSameGroup = advent.GetNodesInSameGroup(nodes, 0);

            Check.That(nodeInSameGroup.Count).Equals(6);
        }
コード例 #4
0
        public void Get_Higher_Value_During_Process()
        {
            var reader = new ReadFile();
            var lines  = reader.GetContentByLine("Day08ExFile");

            foreach (var line in lines)
            {
                var instructionParts = advent.GetInstructionParts(line);
                advent.ProcessInstructionResult(instructionParts);
            }

            Check.That(advent.HigherValueDuringProcess).Equals(10);
        }
コード例 #5
0
        public void Get_Processed_Instruction()
        {
            var reader = new ReadFile();
            var lines  = reader.GetContentByLine("Day08ExFile");

            foreach (var line in lines)
            {
                var instructionParts = advent.GetInstructionParts(line);
                advent.ProcessInstructionResult(instructionParts);
            }

            Check.That(advent.Register.Max(r => r.Value)).Equals(1);
        }
コード例 #6
0
        public void Get_The_Bottom_Program()
        {
            var reader       = new ReadFile();
            var listProgramm = new List <Program>();
            var lines        = reader.GetContentByLine("Day07ExFile");

            foreach (var line in lines)
            {
                listProgramm.Add(advent.Parse(line));
            }

            var bottomProgram = advent.GetBottomProgram(listProgramm);

            Check.That(bottomProgram.Name).Equals("tknk");
        }
コード例 #7
0
        public void Get_The_Balance_Weight(int weightToSubstractExpected)
        {
            var reader      = new ReadFile();
            var listProgram = new List <Program>();
            var lines       = reader.GetContentByLine("Day07ExFile");

            foreach (var line in lines)
            {
                listProgram.Add(advent.Parse(line));
            }

            listProgram = advent.GetUpdatedPrograms(listProgram);
            var program = advent.GetTheUnbalancedTowerProgram(listProgram);

            Check.That(GetWeightToSubtract(program)).Equals(weightToSubstractExpected);
        }
コード例 #8
0
        public void Get_The_Total_Weight(string name, int totalWeightExpected)
        {
            var reader      = new ReadFile();
            var listProgram = new List <Program>();
            var lines       = reader.GetContentByLine("Day07ExFile");

            foreach (var line in lines)
            {
                listProgram.Add(advent.Parse(line));
            }

            listProgram = advent.GetUpdatedPrograms(listProgram);
            var program = listProgram.First(lp => lp.Name == name);

            Check.That(program.Children.Sum(c => c.Weight) + program.Weight).Equals(totalWeightExpected);
        }