diff --git a/src/Http/Http.Extensions/test/HttpMetricsEndpointConventionBuilderExtensionsTests.cs b/src/Http/Http.Extensions/test/HttpMetricsEndpointConventionBuilderExtensionsTests.cs new file mode 100644 index 000000000000..960b3fceaed9 --- /dev/null +++ b/src/Http/Http.Extensions/test/HttpMetricsEndpointConventionBuilderExtensionsTests.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http.Metadata; + +namespace Microsoft.AspNetCore.Http.Extensions.Tests; + +public partial class HttpMetricsEndpointConventionBuilderExtensionsTests +{ + [Fact] + public void DisableHttpMetrics_AddsMetadata() + { + var builder = new TestEndointConventionBuilder(); + builder.DisableHttpMetrics(); + + Assert.IsAssignableFrom(Assert.Single(builder.Metadata)); + } + + private sealed class TestEndointConventionBuilder : EndpointBuilder, IEndpointConventionBuilder + { + public void Add(Action convention) + { + convention(this); + } + + public override Endpoint Build() => throw new NotImplementedException(); + } +}