public void Should_Multiple_Slope_Trees() { var values = new[] { "..##.......", "#...#...#..", ".#....#..#.", "..#.#...#.#", ".#...##..#.", "..#.##.....", ".#.#.#....#", ".#........#", "#.##...#...", "#...##....#", ".#..#...#.#" }; var map = ForestMapper.Map(values); var slopes = new (int r, int d)[]
public void Should_Count_Slope_Trees(int rightSlope, int downSlope, int expectedNumberOfTrees) { var values = new[] { "..##.......", "#...#...#..", ".#....#..#.", "..#.#...#.#", ".#...##..#.", "..#.##.....", ".#.#.#....#", ".#........#", "#.##...#...", "#...##....#", ".#..#...#.#" }; var map = ForestMapper.Map(values); var result = map.CountSlopeTrees(rightSlope, downSlope); result.Should().Be(expectedNumberOfTrees); }
public void Should_Map_ForestMap() { var values = new[] { "..##.......", "#...#...#..", ".#....#..#.", "..#.#...#.#", ".#...##..#.", "..#.##.....", ".#.#.#....#", ".#........#", "#.##...#...", "#...##....#", ".#..#...#.#" }; var map = ForestMapper.Map(values); var sb = new StringBuilder(); var output = new StringWriter(sb); map.PrintMap(output); sb.ToString().Should().BeEquivalentTo(string.Join(Environment.NewLine, values)); }