public async Task Should_Skip_Request_Telemetry_When_Filtered_Out()
{
// given
var channel = new MockTelemetryChannel();
var request = Mock.Of<IOwinRequest>(r =>
r.Method == "GET" &&
r.Path == new PathString("/path") &&
r.Uri == new Uri("http://google.com/path")
);
var response = Mock.Of<IOwinResponse>(r => r.StatusCode == 200);
var context = new MockOwinContextBuilder()
.WithRequest(request)
.WithResponse(response)
.Build();
var configuration = new TelemetryConfigurationBuilder()
.WithChannel(channel)
.Build();
var sut = new OperationIdContextMiddleware(
new HttpRequestTrackingMiddleware(
new NoopMiddleware(), configuration, (req, resp) => false),
new OperationIdContextMiddlewareConfiguration());
// when
await sut.Invoke(context);
// then
channel.SentTelemetries.Count.Should().Be(0);
}