public void CacheInputData() { var mockFileSystem = GetFileSystem(); var fakeClient = new AoCFakeClient(2015); var testInputData = "Silly input data"; fakeClient.SetInputData(testInputData); var engine = new Engine(2015, fakeClient, mockFileSystem); // run the algo twice engine.RunDay(() => new FakeSolver(10, null, null)); engine.RunDay(() => new FakeSolver(10, null, null)); // input data should have been called once Check.That(fakeClient.NbRequest).IsEqualTo(1); }
public void SetUpEverythingProperly() { var mockFileSystem = GetFileSystem(); var fakeClient = new AoCFakeClient(2015); var testInputData = "Silly input data"; fakeClient.SetInputData(testInputData); var engine = new Engine(2015, fakeClient, mockFileSystem); var algo = new FakeSolver(10, null, null); using var console = new CaptureConsole(); engine.RunDay(() => algo); // verify the day is properly set up Check.That(engine.Day).IsEqualTo(10); // it should have received the provided input data Check.That(algo.InputData).IsEqualTo(testInputData); Check.That(fakeClient.NbRequest).IsEqualTo(1); }
public void HandleWhenNoAnswerProvided() { var mockFileSystem = GetFileSystem(); var fakeClient = new AoCFakeClient(2015); var testInputData = "Silly input data"; fakeClient.SetInputData(testInputData); var engine = new Engine(2015, fakeClient, mockFileSystem); var algo = new FakeSolver(10, null, null); using var console = new CaptureConsole(); engine.RunDay(() => algo); // it should request the first answer Check.That(algo.GetAnswer1Calls).IsEqualTo(1); // and not the second Check.That(algo.GetAnswer2Calls).IsEqualTo(0); // it should say that no answer was provided Check.That(console.Output).Contains("No answer provided"); // it should have received the provided input data Check.That(algo.InputData).IsEqualTo(testInputData); }