Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Ting committed Mar 24, 2023
1 parent 0946b08 commit c983566
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,32 @@ public void ToOtlpSpanActivityStatusTakesPrecedenceOverStatusTagsWhenActivitySta
Assert.Equal(StatusDescriptionOnError, otlpSpan.Status.Message);
}

[Theory]
[InlineData(true)]
[InlineData(false)]
public void ToOtlpSpanTraceStateTest(bool traceStateWasSet)
{
using var activitySource = new ActivitySource(nameof(this.ToOtlpSpanTest));
using var activity = activitySource.StartActivity("Name");
string tracestate = "a=b;c=d";
if (traceStateWasSet)
{
activity.TraceStateString = tracestate;
}

var otlpSpan = activity.ToOtlpSpan(DefaultSdkLimitOptions);

if (traceStateWasSet)
{
Assert.NotNull(otlpSpan.TraceState);
Assert.Equal(tracestate, otlpSpan.TraceState);
}
else
{
Assert.True(string.IsNullOrEmpty(otlpSpan.TraceState));
}
}

[Fact]
public void ToOtlpSpanPeerServiceTest()
{
Expand Down

0 comments on commit c983566

Please sign in to comment.