/// <summary> /// Create and populate a mock event wrapped by a mock envelope /// </summary> /// <param name="traceData">A mock ETW event to pull the data from</param> /// <returns>The mock envelope</returns> protected override EtwEventEnvelope WrapTraceEvent(TraceEvent traceData) { var envelope = new MockEtwEventEnvelope(traceData); envelope.Data.ExecutingThreadID = MockThreadID; return(envelope); }
public void TestEventProcessing() { //Configure ListEventSink mockSink = new ListEventSink(); using (EtwEventSource mockEtwSource = new MockEtwEventSource(MockTraceEvent.ClrProviderName, TraceEventLevel.Verbose, ulong.MaxValue, new PluginContext(null, null, null))) { mockEtwSource.Subscribe(mockSink); //Execute mockEtwSource.Start(); mockEtwSource.Stop(); } //Verify Assert.True(mockSink.Count == 1); Assert.True(mockSink[0] is EtwEventEnvelope); Assert.True(MockEtwEventEnvelope.ValidateEnvelope((EtwEventEnvelope)mockSink[0]), "Event envelope data or event data does not match expected values."); }