Skip to content

Commit

Permalink
Code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
stebet committed Jan 26, 2024
1 parent 124fa78 commit a387d76
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions projects/Test/Integration/TestActivitySource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public async Task TestPublisherAndConsumerActivityTags(bool useRoutingKeyAsOpera
byte[] sendBody = Encoding.UTF8.GetBytes("hi");
byte[] consumeBody = null;
var consumer = new EventingBasicConsumer(_channel);
var consumerReceivedTcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
var consumerReceivedTcs =
new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
consumer.Received += (o, a) =>
{
consumeBody = a.Body.ToArray();
Expand Down Expand Up @@ -130,7 +131,8 @@ public async Task TestPublisherAndConsumerActivityTagsAsync(bool useRoutingKeyAs
byte[] sendBody = Encoding.UTF8.GetBytes("hi");
byte[] consumeBody = null;
var consumer = new EventingBasicConsumer(_channel);
var consumerReceivedTcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
var consumerReceivedTcs =
new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
consumer.Received += (o, a) =>
{
consumeBody = a.Body.ToArray();
Expand Down Expand Up @@ -205,14 +207,14 @@ private void AssertActivityData(bool useRoutingKeyAsOperationName, string queueN
string childName = isDeliver ? "deliver" : "receive";
Activity[] activities = activityList.ToArray();
Assert.NotEmpty(activities);
foreach(var item in activities)
foreach (var item in activities)
{
_output.WriteLine(
$"{item.Context.TraceId}: {item.OperationName}");
_output.WriteLine($" Tags: {string.Join(", ", item.Tags.Select(x => $"{x.Key}: {x.Value}"))}");
_output.WriteLine($" Links: {string.Join(", ", item.Links.Select(x => $"{x.Context.TraceId}"))}");
}

Activity sendActivity = activities.First(x =>
x.OperationName == (useRoutingKeyAsOperationName ? $"{queueName} publish" : "publish") &&
x.GetTagItem(RabbitMQActivitySource.MessagingDestinationRoutingKey) is string routingKeyTag &&
Expand Down

0 comments on commit a387d76

Please sign in to comment.