-
Notifications
You must be signed in to change notification settings - Fork 8
/
ModifyInputFilePathTests_SampleTests.cs
39 lines (33 loc) · 1.24 KB
/
ModifyInputFilePathTests_SampleTests.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
33
34
35
36
37
38
39
using NUnit.Framework;
namespace AoCHelper.Test;
public class ModifyInputFilePathTests
{
abstract class CustomInputPathBaseDay : BaseDay
{
public string TestInputFilePath { private get; set; }
public override string InputFilePath => TestInputFilePath;
protected CustomInputPathBaseDay()
{
TestInputFilePath = base.InputFilePath;
}
}
class Day_99 : CustomInputPathBaseDay
{
public override ValueTask<string> Solve_1() => new($"Custom file path: {InputFilePath}");
public override ValueTask<string> Solve_2() => new($"No longer useful InputFileDirPath: {InputFileDirPath}");
}
[TestCase(typeof(Day_99), "TestInputs/Day_1234.txt", "Custom file path: TestInputs/Day_1234.txt", "No longer useful InputFileDirPath: Inputs")]
public async Task ModifyInputFilePath(Type type, string inputFilePath, string sol1, string sol2)
{
if (Activator.CreateInstance(type) is CustomInputPathBaseDay instance)
{
instance.TestInputFilePath = inputFilePath;
Assert.AreEqual(sol1, await instance.Solve_1());
Assert.AreEqual(sol2, await instance.Solve_2());
}
else
{
Assert.Fail();
}
}
}