chore: add xml comments
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
namespace CubeConundrum.Tests;
|
||||
|
||||
public class GameTests
|
||||
{
|
||||
[Theory, MemberData(nameof(TestData.Games), MemberType = typeof(TestData))]
|
||||
public void PowerOfMinimumCubesNeeded_GivenAGame_ItShouldReturnTheSumOfTheMinimumCubesNeededForEachResult(Game game, int expected)
|
||||
{
|
||||
game.PowerOfMinimumCubesNeeded.Should().Be(expected);
|
||||
}
|
||||
|
||||
public static class TestData
|
||||
{
|
||||
public static readonly IEnumerable<object[]> Games = new List<object[]>
|
||||
{
|
||||
new object[]
|
||||
{
|
||||
new Game
|
||||
{
|
||||
Id = 1,
|
||||
Results =
|
||||
{
|
||||
new()
|
||||
{
|
||||
Cubes =
|
||||
{
|
||||
new() { Count = 3, Color = CubeColor.Blue },
|
||||
new() { Count = 4, Color = CubeColor.Red }
|
||||
}
|
||||
},
|
||||
new()
|
||||
{
|
||||
Cubes =
|
||||
{
|
||||
new() { Count = 1, Color = CubeColor.Red },
|
||||
new() { Count = 2, Color = CubeColor.Green },
|
||||
new() { Count = 6, Color = CubeColor.Blue }
|
||||
}
|
||||
},
|
||||
new()
|
||||
{
|
||||
Cubes =
|
||||
{
|
||||
new() { Count = 2, Color = CubeColor.Green },
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
48
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,11 @@ public class ProgramTests
|
||||
var result = await Program.Main(["INPUT.txt"]);
|
||||
result.Should().Be(2879);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Main_GivenInputAndPart2_ItShouldReturnExpectedSum()
|
||||
{
|
||||
var result = await Program.Main(["INPUT.txt", "part2"]);
|
||||
result.Should().Be(65122);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
namespace CubeConundrum.Tests;
|
||||
|
||||
public class PartOnePuzzleSolverTests
|
||||
public class PuzzleSolverTests
|
||||
{
|
||||
private readonly PartOnePuzzleSolver _sut = new();
|
||||
private readonly PuzzleSolver _sut = new();
|
||||
|
||||
[Theory, MemberData(nameof(TestData.Results), MemberType = typeof(TestData))]
|
||||
public void IsResultPossible_GivenAResult_ItShouldReturnExpectedOutcome(Result givenResult, bool expected)
|
||||
@@ -5,7 +5,7 @@ public class PuzzleParserTests
|
||||
private readonly PuzzleParser _sut = new();
|
||||
|
||||
[Theory, MemberData(nameof(TestData.CubeStrings), MemberType = typeof(TestData))]
|
||||
public void ParseCube_GivenAStringThatRepresentsACube_ItShouldReturnTheEquivalentCubeModel(string input, Cube expected)
|
||||
public void ParseCube_GivenAStringThatRepresentsACube_ItShouldReturnTheEquivalentCubeModel(string input, CubeCollection expected)
|
||||
{
|
||||
var result = _sut.ParseCube(input);
|
||||
result.Should().BeEquivalentTo(expected);
|
||||
@@ -29,9 +29,9 @@ public class PuzzleParserTests
|
||||
{
|
||||
public static readonly IEnumerable<object[]> CubeStrings = new List<object[]>
|
||||
{
|
||||
new object[] { "4 red", new Cube { Count = 4, Color = CubeColor.Red } },
|
||||
new object[] { "1 green", new Cube { Count = 1, Color = CubeColor.Green } },
|
||||
new object[] { "2 blue", new Cube { Count = 2, Color = CubeColor.Blue } }
|
||||
new object[] { "4 red", new CubeCollection { Count = 4, Color = CubeColor.Red } },
|
||||
new object[] { "1 green", new CubeCollection { Count = 1, Color = CubeColor.Green } },
|
||||
new object[] { "2 blue", new CubeCollection { Count = 2, Color = CubeColor.Blue } }
|
||||
};
|
||||
|
||||
public static readonly IEnumerable<object[]> ResultStrings = new List<object[]>
|
||||
|
||||
Reference in New Issue
Block a user