Removed Moq dependency from Instrumentation.AspNetCore.Tests (#5123)
This commit is contained in:
parent
cd5b753785
commit
a963ec809a
|
|
@ -24,7 +24,6 @@ using Microsoft.AspNetCore.TestHost;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using OpenTelemetry.Context.Propagation;
|
||||
using OpenTelemetry.Instrumentation.AspNetCore.Implementation;
|
||||
using OpenTelemetry.Tests;
|
||||
|
|
@ -205,14 +204,11 @@ public sealed class BasicTests
|
|||
var expectedTraceId = ActivityTraceId.CreateRandom();
|
||||
var expectedSpanId = ActivitySpanId.CreateRandom();
|
||||
|
||||
var propagator = new Mock<TextMapPropagator>();
|
||||
propagator.Setup(m => m.Extract(It.IsAny<PropagationContext>(), It.IsAny<HttpRequest>(), It.IsAny<Func<HttpRequest, string, IEnumerable<string>>>())).Returns(
|
||||
new PropagationContext(
|
||||
new ActivityContext(
|
||||
expectedTraceId,
|
||||
expectedSpanId,
|
||||
ActivityTraceFlags.Recorded),
|
||||
default));
|
||||
var propagator = new CustomTextMapPropagator
|
||||
{
|
||||
TraceId = expectedTraceId,
|
||||
SpanId = expectedSpanId,
|
||||
};
|
||||
|
||||
// Arrange
|
||||
using (var testFactory = this.factory
|
||||
|
|
@ -220,7 +216,7 @@ public sealed class BasicTests
|
|||
{
|
||||
builder.ConfigureTestServices(services =>
|
||||
{
|
||||
Sdk.SetDefaultTextMapPropagator(propagator.Object);
|
||||
Sdk.SetDefaultTextMapPropagator(propagator);
|
||||
var tracerProviderBuilder = Sdk.CreateTracerProviderBuilder();
|
||||
|
||||
if (addSampler)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="Moq" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="All">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
|
|
@ -33,6 +32,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\CustomTextMapPropagator.cs" Link="Includes\CustomTextMapPropagator.cs" />
|
||||
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\EventSourceTestHelper.cs" Link="Includes\EventSourceTestHelper.cs" />
|
||||
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\InMemoryEventListener.cs" Link="Includes\InMemoryEventListener.cs" />
|
||||
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\TestEventListener.cs" Link="Includes\TestEventListener.cs" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue