mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-19 00:27:04 +01:00
* Update aspire to 13.1 (examples + code) Allows usage of aspire CLI which is very useful for dev in codespaces (for my next PR). * Add OTEL support * Initial PR feedback * PR feedback * PR feedback * PR feedback * Cleanup. * Cleanup * Fix * Fix * Rename stuff around to be more accurate * PR feedback * Update WireMock.Net.OpenTelemetry.csproj Update <Authors> * PR feedback parser * PR feedback package versions * Status code feedback. * Update preprocessor directives to to Activity Tracing instead of OpenTelemetry. Is more descriptive. * Add tests * Improve tests --------- Co-authored-by: Stef Heyenrath <Stef.Heyenrath@gmail.com>
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
#if NET6_0_OR_GREATER
|
|
using FluentAssertions;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using WireMock.OpenTelemetry;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.OpenTelemetry;
|
|
|
|
public class WireMockOpenTelemetryExtensionsTests
|
|
{
|
|
[Fact]
|
|
public void AddWireMockOpenTelemetry_WithNullOptions_ShouldNotAddServices()
|
|
{
|
|
// Arrange
|
|
var services = new ServiceCollection();
|
|
var initialCount = services.Count;
|
|
|
|
// Act
|
|
var result = services.AddWireMockOpenTelemetry(null);
|
|
|
|
// Assert
|
|
result.Should().BeSameAs(services);
|
|
services.Count.Should().Be(initialCount);
|
|
}
|
|
|
|
[Fact]
|
|
public void AddWireMockOpenTelemetry_WithOptions_ShouldAddServices()
|
|
{
|
|
// Arrange
|
|
var services = new ServiceCollection();
|
|
var initialCount = services.Count;
|
|
|
|
// Act
|
|
var result = services.AddWireMockOpenTelemetry(new OpenTelemetryOptions());
|
|
|
|
// Assert
|
|
result.Should().BeSameAs(services);
|
|
services.Count.Should().BeGreaterThan(initialCount);
|
|
}
|
|
}
|
|
#endif
|