Skip to content

Commit 9c40ed7

Browse files
committed
Remove tests with Activity
1 parent f809e23 commit 9c40ed7

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

src/Hosting/Hosting/test/HostingApplicationDiagnosticsTests.cs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -40,50 +40,6 @@ public void CreateContextWithDisabledLoggerDoesNotCreateActivity()
4040
Assert.Null(Activity.Current);
4141
}
4242

43-
[Fact]
44-
public void CreateContextWithEnabledLoggerCreatesActivityAndSetsActivityInScope()
45-
{
46-
// Arrange
47-
var logger = new LoggerWithScopes(isEnabled: true);
48-
var hostingApplication = CreateApplication(out var features, logger: logger);
49-
50-
// Act
51-
var context = hostingApplication.CreateContext(features);
52-
53-
Assert.Single(logger.Scopes);
54-
var pairs = ((IReadOnlyList<KeyValuePair<string, object>>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value);
55-
Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString());
56-
Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString());
57-
Assert.Equal(string.Empty, pairs["ParentId"]?.ToString());
58-
}
59-
60-
[Fact]
61-
public void CreateContextWithEnabledLoggerAndRequestIdCreatesActivityAndSetsActivityInScope()
62-
{
63-
// Arrange
64-
65-
// Generate an id we can use for the request id header (in the correct format)
66-
var activity = new Activity("IncomingRequest");
67-
activity.Start();
68-
var id = activity.Id;
69-
activity.Stop();
70-
71-
var logger = new LoggerWithScopes(isEnabled: true);
72-
var hostingApplication = CreateApplication(out var features, logger: logger, configure: context =>
73-
{
74-
context.Request.Headers["Request-Id"] = id;
75-
});
76-
77-
// Act
78-
var context = hostingApplication.CreateContext(features);
79-
80-
Assert.Single(logger.Scopes);
81-
var pairs = ((IReadOnlyList<KeyValuePair<string, object>>)logger.Scopes[0]).ToDictionary(p => p.Key, p => p.Value);
82-
Assert.Equal(Activity.Current.Id, pairs["SpanId"].ToString());
83-
Assert.Equal(Activity.Current.RootId, pairs["TraceId"].ToString());
84-
Assert.Equal(id, pairs["ParentId"].ToString());
85-
}
86-
8743
[Fact]
8844
public void ActivityStopDoesNotFireIfNoListenerAttachedForStart()
8945
{

0 commit comments

Comments
 (0)