public void BadInput() { var processingNotificationsCollector = new ProcessingNotificationsCollector(10); var testWriterFactory = new TestWriterFactory(); using (var plugin = new VizportalPlugin()) { 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); var wrongContent = new LogLine(new ReadLogLineResult(123, "I am not a log line!"), TestLogFileInfo); plugin.ProcessLogLine(wrongContentFormat, LogType.VizportalJava); plugin.ProcessLogLine(nullContent, LogType.VizportalJava); plugin.ProcessLogLine(wrongContent, LogType.VizportalJava); plugin.CompleteProcessing(); } testWriterFactory.AssertAllWritersAreDisposedAndEmpty(1); processingNotificationsCollector.TotalErrorsReported.Should().Be(3); }
public void RunTestCases() { var testWriterFactory = new TestWriterFactory(); using (var plugin = new VizportalPlugin()) { plugin.Configure(testWriterFactory, null, null, new NullLoggerFactory()); foreach (var testCase in _testCases) { var logLine = testCase.GetLogLine(); plugin.ProcessLogLine(logLine, LogType.VizportalJava); } plugin.CompleteProcessing(); } var expectedOutput = _testCases.Select(testCase => testCase.ExpectedOutput).ToList(); var testWriter = testWriterFactory.GetOneWriterAndVerifyOthersAreEmptyAndDisposed <VizportalEvent>("VizportalEvents", 1); testWriter.ReceivedObjects.Should().BeEquivalentTo(expectedOutput); }
public void RunTestCases() { var testWriterFactory = new TestWriterFactory(); using (var plugin = new VizportalPlugin()) { plugin.Configure(testWriterFactory, null, null, new NullLoggerFactory()); foreach (var testCase in _testCases) { var logLine = testCase.GetLogLine(); plugin.ProcessLogLine(logLine, LogType.VizportalJava); } plugin.CompleteProcessing(); } var expectedOutput = _testCases.Select(testCase => testCase.ExpectedOutput).ToList(); var testWriter = testWriterFactory.Writers.Values.First() as TestWriter <VizportalEvent>; testWriterFactory.Writers.Count.Should().Be(1); testWriter.WasDisposed.Should().Be(true); testWriter.ReceivedObjects.Should().BeEquivalentTo(expectedOutput); }