コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: willoftw/AOC
 public void ShouldCountDistinctsCorrectlyForData()
 {
     using (AOC aoc = new AOC())
     {
         List <int> expected = new List <int>()
         {
             3, 3, 3, 1, 1
         };
         Assert.Equal(expected, aoc.CountDistinctAnswers(input));
     }
 }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: willoftw/AOC
 public void ShouldAddAllDistinctValuesCorrectly()
 {
     using (AOC aoc = new AOC())
     {
         List <int> distinctAnswers = aoc.CountDistinctAnswers(input_2);
         //int ans = distinctAnswers.Aggregate(1, (x,y) => x * y);
         int prod = 0;
         foreach (int value in distinctAnswers)
         {
             if (value == 0)
             {
                 continue;
             }
             prod += value;
         }
         Assert.Equal(7128, prod);
     }
 }