-
Notifications
You must be signed in to change notification settings - Fork 8
/
ModifyInputFileDirPath_SampleTests.cs
39 lines (33 loc) · 1.22 KB
/
ModifyInputFileDirPath_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 ModifyInputFileDirPathTests
{
abstract class CustomDirBaseDay : BaseDay
{
public string TestInputFileDirPath { private get; set; }
protected override string InputFileDirPath => TestInputFileDirPath;
protected CustomDirBaseDay()
{
TestInputFileDirPath = base.InputFileDirPath;
}
}
class Day_99 : CustomDirBaseDay
{
public override ValueTask<string> Solve_1() => new($"Custom file path: {InputFilePath}");
public override ValueTask<string> Solve_2() => new($"Custom dir path: {InputFileDirPath}");
}
[TestCase(typeof(Day_99), "CustomInputDir/", "Custom file path: CustomInputDir/99.txt", "Custom dir path: CustomInputDir/")]
public async Task ModifyInputFileDirPath(Type type, string inputFileDirPath, string sol1, string sol2)
{
if (Activator.CreateInstance(type) is CustomDirBaseDay instance)
{
instance.TestInputFileDirPath = inputFileDirPath;
Assert.AreEqual(sol1, await instance.Solve_1());
Assert.AreEqual(sol2, await instance.Solve_2());
}
else
{
Assert.Fail();
}
}
}