public void HandlerGoodAnswerToQuestion2() { var fakeClient = new AoCFakeClient(2015); using var console = new CaptureConsole(); var mockFileSystem = GetFileSystem(); fakeClient.SetAnswerResponseFilename(1, GoodAnswerFile); fakeClient.SetAnswerResponseFilename(2, GoodAnswerFile); var engine = new Engine(2015, fakeClient, mockFileSystem); var algo = new FakeSolver(10, 12, 13); engine.RunDay(() => algo); Check.That(algo.GetAnswer1Calls).IsEqualTo(1); Check.That(console.Output).Contains("Question 1 passed!"); Check.That(console.Output).Contains("Question 2 passed!"); }
public void HandlerWrongAnswerToQuestion2() { var fakeClient = new AoCFakeClient(2015); using var console = new CaptureConsole(); var mockFileSystem = GetFileSystem(); fakeClient.SetAnswerResponseFilename(1, GoodAnswerFile); fakeClient.SetAnswerResponseFilename(2, WrongAnswerFile); var engine = new Engine(2015, fakeClient, mockFileSystem); var algo = new FakeSolver(10, 12, 13); engine.RunDay(() => algo); Check.That(algo.GetAnswer1Calls).IsEqualTo(1); Check.That(console.Output).Contains("AoC site response"); Check.That(console.Output).Contains("Day 10-1:"); Check.That(console.Output).Contains("Day 10-2:"); Check.That(algo.GetAnswer2Calls).IsEqualTo(1); Check.That(mockFileSystem.AllFiles.Any(p => Regex.IsMatch(p, "Answer1.*\\.html"))); Check.That(mockFileSystem.AllFiles.Any(p => Regex.IsMatch(p, "Answer2.*\\.html"))); Check.That(console.Output).Contains("Question 1 passed!"); Check.That(console.Output).Contains("Question 2 failed!"); }