コード例 #1
0
        public void Part2()
        {
            TicketData             ticketData             = TicketDataParser.Parse(StringListRetriever.Retreive("InputList15.txt").ToList());
            TicketValidationResult ticketValidationResult = TicketValidator.ValidateNearby(ticketData);
            FieldOrderResult       fieldOrderResult       = FieldOrderFinder.FindFieldOrderFor(ticketValidationResult.Tickets, ticketData.ValidationRules);

            Assert.Equal(1307550234719, fieldOrderResult.FieldOrder.Keys.Where(x => x.StartsWith("departure"))
                         .Select(x => System.Convert.ToInt64(ticketData.Tickets[0].DataItems[fieldOrderResult.FieldOrder[x]]))
                         .Aggregate <long, long>(1, (x, y) => x * y));
        }
コード例 #2
0
        public void Part2Sample()
        {
            TicketData ticketData = TicketDataParser.Parse(GetPart2SampleData());

            Assert.Equal(3, ticketData.ValidationRules.Count);
            Assert.Equal(4, ticketData.Tickets.Count);
            TicketValidationResult ticketValidationResult = TicketValidator.ValidateNearby(ticketData);

            Assert.Equal(3, ticketValidationResult.Tickets.Count);
            FieldOrderResult fieldOrderResult = FieldOrderFinder.FindFieldOrderFor(ticketValidationResult.Tickets, ticketData.ValidationRules);
        }