-
Notifications
You must be signed in to change notification settings - Fork 0
/
Task34Tests.cs
32 lines (30 loc) · 891 Bytes
/
Task34Tests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using adventofcode_2021.Task34;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xunit;
namespace adventofcode_2021.Tests
{
public class Task34Tests
{
[Fact]
public void Task34_RealExample_Correct()
{
var result = ReadFileAsync(Path.Combine("Task34", "Data.txt"));
Assert.Equal(112, Solution.Function(result[0], result[1]));
}
private List<(int, int)> ReadFileAsync(string file)
{
return File.ReadLines(file)
.ElementAt(0)
.Split("target area: ")[1]
.Split(", ")
.Select(x =>
{
var data = new string(x.Skip(2).ToArray()).Split("..");
return (int.Parse(data[0]), int.Parse(data[1]));
})
.ToList();
}
}
}