public void MemorySampleEvent(string payload, bool expectEvent, long expectedMemoryUtil, long expectedTotalUtil) { var processingNotificationsCollector = new ProcessingNotificationsCollector(10); using (var eventProcessor = new ResourceManagerEventsProcessor(_testWriterFactory, processingNotificationsCollector)) { eventProcessor.ProcessEvent(_testBaseEvent, payload, _testLogLine, TestProcessName); } var memorySampleWriter = _testWriterFactory.GetOneWriterAndVerifyOthersAreEmptyAndDisposed <ResourceManagerMemorySample>("ResourceManagerMemorySamples", 5); memorySampleWriter.ReceivedObjects.Count.Should().Be(expectEvent ? 1 : 0); processingNotificationsCollector.TotalErrorsReported.Should().Be(expectEvent ? 0 : 1); if (expectEvent) { var expectedRecord = new { FileName = TestLogFileInfo.FileName, FilePath = TestLogFileInfo.FilePath, LineNumber = _testLogLine.LineNumber, Timestamp = _testBaseEvent.Timestamp, Worker = TestLogFileInfo.Worker, ProcessId = _testBaseEvent.ProcessId, ProcessIndex = (int?)null, ProcessName = TestProcessName, ProcessMemoryUtil = expectedMemoryUtil, TotalMemoryUtil = expectedTotalUtil, }; memorySampleWriter.ReceivedObjects[0].Should().BeEquivalentTo(expectedRecord); } }
public void NonEvents(string payload) { using (var eventProcessor = new ResourceManagerEventsProcessor(_testWriterFactory, null)) { eventProcessor.ProcessEvent(_testBaseEvent, payload, _testLogLine, TestProcessName); } _testWriterFactory.AssertAllWritersAreDisposedAndEmpty(5); }