-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStrongNamedTests.cs
51 lines (40 loc) · 1.71 KB
/
StrongNamedTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#if NETFRAMEWORK
using System.Reflection;
using FluentAssertions;
#endif
using IntegrationTests.Helpers;
using Xunit.Abstractions;
namespace IntegrationTests;
public class StrongNamedTests : TestHelper
{
public StrongNamedTests(ITestOutputHelper output)
: base("StrongNamed", output)
{
}
[Fact]
public void SubmitsTraces()
{
using var collector = new MockSpansCollector(Output);
SetExporter(collector);
collector.Expect("ByteCode.Plugin.StrongNamedValidation");
EnableBytecodeInstrumentation();
SetEnvironmentVariable("OTEL_DOTNET_AUTO_TRACES_ADDITIONAL_SOURCES", "ByteCode.Plugin.StrongNamedValidation");
SetEnvironmentVariable("OTEL_DOTNET_AUTO_PLUGINS", "TestLibrary.InstrumentationTarget.Plugin, TestLibrary.InstrumentationTarget, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c0db600a13f60b51");
RunTestApplication();
// TODO: When native logs are moved to an EventSource implementation check for the log
// TODO: entries reporting the missing instrumentation type and missing instrumentation methods.
// TODO: See https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/issues/960
collector.AssertExpectations();
}
#if NETFRAMEWORK
[Fact]
public void VerifyIfApplicationHasStrongName()
{
var testApplicationPath = EnvironmentHelper.GetTestApplicationPath();
var assembly = Assembly.ReflectionOnlyLoadFrom(testApplicationPath);
BitConverter.ToString(assembly.GetName().GetPublicKeyToken()).Replace("-", string.Empty).ToLowerInvariant().Should().Be("c0db600a13f60b51");
}
#endif
}