Files
advent-of-code-2024/15/WarehouseWoes.Tests/PuzzleParserTests.cs
T

41 lines
1.2 KiB
C#
Raw Normal View History

namespace WarehouseWoes.Tests;
public class PuzzleParserTests
{
private async Task<string> GetPuzzleInput()
{
return await File.ReadAllTextAsync(Path.Combine(AppContext.BaseDirectory, "INPUT.txt"));
}
[Test]
public async Task Parse_WhenCalled_ItShouldReturnMapAndDirections()
{
var input = await GetPuzzleInput();
var result = PuzzleParser.Parse(input);
await Assert.That(result.Map).IsTypeOf<WarehouseMap>();
await Assert.That(result.Directions).IsTypeOf<List<Direction>>();
}
[Test]
public async Task PartOneSolution_WhenGivenPuzzleInput_ItShouldReturnExpectedSolution()
{
var input = await GetPuzzleInput();
var (map, directions) = PuzzleParser.Parse(input);
var result = map.MoveRobot(directions).CalculateTotalBoxGpsCoordinates();
await Assert.That(result).IsEqualTo(1318523);
}
2024-12-16 23:51:43 -06:00
[Test]
public async Task PartTwoSolution_WhenGivenPuzzleInput_ItShouldReturnExpectedSolution()
{
var input = await GetPuzzleInput();
var (map, directions) = PuzzleParser.Parse(input);
var result = map.Scale().MoveRobot(directions).CalculateTotalBoxGpsCoordinates();
await Assert.That(result).IsEqualTo(1337648);
}
}