Throw exception if input not found
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
5593bf56c3
commit
a99591fc3c
@ -11,6 +11,7 @@ steps:
|
||||
- name: test
|
||||
image: mcr.microsoft.com/dotnet/sdk:5.0
|
||||
commands:
|
||||
- ls
|
||||
- dotnet test AOC2021.Test
|
||||
|
||||
- name: build-aoc-2021
|
||||
|
@ -19,7 +19,6 @@ namespace AOC2021.Test
|
||||
Console.WriteLine($"Testing {request.Day} Part A, Test data");
|
||||
if (!string.IsNullOrEmpty(request.Answer.Day_A_Test))
|
||||
response.Answer.Day_A_Test = GetAOCDay(request.Day).ExecuteDay(new AOCRequest() { Input = test, Version = AOCVersion.A }).Answer;
|
||||
Console.WriteLine(response);
|
||||
Console.WriteLine(response.Answer.Day_A_Test);
|
||||
Console.WriteLine($"Testing {request.Day} Part A, Input data");
|
||||
if (!string.IsNullOrEmpty(request.Answer.Day_A_Input))
|
||||
@ -57,16 +56,18 @@ namespace AOC2021.Test
|
||||
|
||||
private string GetTextInput(string day, string type)
|
||||
{
|
||||
var constructedFileName = $"Input\\{day}_{type}.txt";
|
||||
Console.WriteLine("ConstructedFileName: " + constructedFileName);
|
||||
Console.WriteLine("Input File Size: " + Directory.GetFiles("Input").Length);
|
||||
foreach (var file in Directory.GetFiles("Input"))
|
||||
{
|
||||
var constructedFileName = $"Input\\{day}_{type}.txt";
|
||||
if (file.ToLower().Equals(constructedFileName.ToLower()))
|
||||
{
|
||||
Console.WriteLine("Loading " + file);
|
||||
return File.ReadAllText(file);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
throw new Exception($"No Text Input found for {day} {type}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user