private (Guid, TracingHeaders) TracingBefore(string topic, string values) { Guid operationId = Guid.NewGuid(); var eventData = new BrokerPublishEventData( operationId, "", ServersAddress, topic, values, DateTimeOffset.UtcNow); s_diagnosticListener.WritePublishBefore(eventData); return(operationId, eventData.Headers); //if not enabled diagnostics ,the header will be null }
public void WritePublishBeforeTest() { Guid operationId = Guid.NewGuid(); DiagnosticsWapper(() => { var eventData = new BrokerPublishEventData(operationId, "", "", "", "", DateTimeOffset.UtcNow); s_diagnosticListener.WritePublishBefore(eventData); }, kvp => { if (kvp.Key.Equals(CapDiagnosticListenerExtensions.CapBeforePublish)) { Assert.NotNull(kvp.Value); Assert.IsType <BrokerPublishEventData>(kvp.Value); Assert.Equal(operationId, ((BrokerPublishEventData)kvp.Value).OperationId); } }); }