public void BadOrNoOpInput() { var processingNotificationsCollector = new ProcessingNotificationsCollector(10); var parser = new BackgrounderEventParser(_persisterMock.Object, processingNotificationsCollector); var logLine = _startTestCases[0].GetLogLine(); parser.ParseAndPersistLine(logLine, null); // Bad input parser.ParseAndPersistLine(logLine, "I am not a backgrounder line!"); // Good input, but doesn't match regex parser.ParseAndPersistLine(logLine, "2018-08-08 11:17:13.491 +1000 (,,,,,:purge_expired_wgsessions,-) scheduled-background-job-runner-1 backgrounder: INFO com.tableausoftware.backgrounder.runner.BackgroundJobRunner - Running job of type PurgeExpiredWgSessions; no timeout; priority: 0; id: 9; args: null"); // Good input, but not error nor has ID _persisterMock.VerifyNoOtherCalls(); processingNotificationsCollector.TotalErrorsReported.Should().Be(2); }
public void ValidLinesThatAreNotPersisted(string input) { var processingNotificationsCollector = new ProcessingNotificationsCollector(10); var parser = new BackgrounderEventParser(_persisterMock.Object, processingNotificationsCollector); var logLine = _startTestCases[0].GetLogLine(); parser.ParseAndPersistLine(logLine, input); _persisterMock.VerifyNoOtherCalls(); processingNotificationsCollector.TotalErrorsReported.Should().Be(0); }
private static void RunTestCasesAndAssertOutput <T>(List <PluginTestCase> testCases, List <T> outputList, IBackgrounderEventPersister persister) { var parser = new BackgrounderEventParser(persister, null); foreach (var testCase in testCases) { parser.ParseAndPersistLine(testCase.GetLogLine(), testCase.LogContents.ToString()); } var expectedOutput = testCases.Select(testCase => testCase.ExpectedOutput).ToList(); outputList.Should().BeEquivalentTo(expectedOutput); }