コード例 #1
0
ファイル: Day3Test.cs プロジェクト: max7969/adventofcode_2020
        public void SolutionPart2()
        {
            // Arrange
            string filePath = $"{new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName}/Day3/Resources/input.txt";
            Day3   day      = new Day3();

            // Act
            var result = day.Compute(filePath, new List <Day3.Slope>
            {
                new Day3.Slope {
                    Right = 3, Bottom = 1
                },
                new Day3.Slope {
                    Right = 1, Bottom = 1
                },
                new Day3.Slope {
                    Right = 5, Bottom = 1
                },
                new Day3.Slope {
                    Right = 7, Bottom = 1
                },
                new Day3.Slope {
                    Right = 1, Bottom = 2
                }
            });

            // Result
            _output.WriteLine(result.ToString());
        }
コード例 #2
0
ファイル: Day3Test.cs プロジェクト: max7969/adventofcode_2020
        public void Test1Part2()
        {
            // Arrange
            string filePath = $"{new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName}/Day3/Resources/test.txt";
            Day3   day      = new Day3();

            // Act
            var result = day.Compute(filePath, new List <Day3.Slope>
            {
                new Day3.Slope {
                    Right = 3, Bottom = 1
                },
                new Day3.Slope {
                    Right = 1, Bottom = 1
                },
                new Day3.Slope {
                    Right = 5, Bottom = 1
                },
                new Day3.Slope {
                    Right = 7, Bottom = 1
                },
                new Day3.Slope {
                    Right = 1, Bottom = 2
                }
            });

            // Assert
            result.Should().Be(336);
        }