public void BadInput() { var processingNotificationsCollector = new ProcessingNotificationsCollector(10); var testWriterFactory = new TestWriterFactory(); using (var plugin = new FilestorePlugin()) { plugin.Configure(testWriterFactory, null, processingNotificationsCollector, new NullLoggerFactory()); var wrongContentFormat = new LogLine(new ReadLogLineResult(123, 1234), TestLogFileInfo); var nullContent = new LogLine(new ReadLogLineResult(123, null), TestLogFileInfo); plugin.ProcessLogLine(wrongContentFormat, LogType.Apache); plugin.ProcessLogLine(nullContent, LogType.Apache); } testWriterFactory.AssertAllWritersAreDisposedAndEmpty(1); processingNotificationsCollector.TotalErrorsReported.Should().Be(2); }
public void RunTestCases() { var testWriterFactory = new TestWriterFactory(); using (var plugin = new FilestorePlugin()) { plugin.Configure(testWriterFactory, null, null, new NullLoggerFactory()); foreach (var testCase in _testCases) { var logLine = testCase.GetLogLine(); plugin.ProcessLogLine(logLine, LogType.Filestore); } } var expectedOutput = _testCases.Select(testCase => testCase.ExpectedOutput).ToList(); testWriterFactory.Writers.Count.Should().Be(1); var testWriter = testWriterFactory.Writers.Values.First() as TestWriter <FilestoreEvent>; testWriter.WasDisposed.Should().Be(true); testWriter.ReceivedObjects.Should().BeEquivalentTo(expectedOutput); }