예제 #1
0
        private (Guid, string) TracingBefore(string topic, string values)
        {
            Guid operationId = Guid.NewGuid();

            var eventData = new BrokerConsumeEventData(
                operationId, "",
                _serverAddress,
                topic,
                values,
                DateTimeOffset.UtcNow);

            s_diagnosticListener.WriteConsumeBefore(eventData);

            return(operationId, eventData.BrokerTopicBody);
        }
예제 #2
0
        public void WriteConsumeBeforeTest()
        {
            Guid operationId = Guid.NewGuid();

            DiagnosticsWapper(() =>
            {
                var eventData = new BrokerConsumeEventData(operationId, "", "", "", "", DateTimeOffset.UtcNow);
                s_diagnosticListener.WriteConsumeBefore(eventData);
            }, kvp =>
            {
                if (kvp.Key.Equals(CapDiagnosticListenerExtensions.CapBeforeConsume))
                {
                    Assert.NotNull(kvp.Value);
                    Assert.IsType <BrokerConsumeEventData>(kvp.Value);
                    Assert.Equal(operationId, ((BrokerConsumeEventData)kvp.Value).OperationId);
                }
            });
        }