mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-22 08:47:51 +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>
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using FluentAssertions;
|
|
using WireMock.Settings;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.Settings;
|
|
|
|
public class WireMockServerSettingsParserTests
|
|
{
|
|
[Fact]
|
|
public void TryParseArguments_With_Args()
|
|
{
|
|
// Act
|
|
var result = WireMockServerSettingsParser.TryParseArguments(new[]
|
|
{
|
|
"--adminPath", "ap"
|
|
}, null, out var settings);
|
|
|
|
// Assert
|
|
result.Should().BeTrue();
|
|
settings.Should().NotBeNull();
|
|
settings!.AdminPath.Should().Be("ap");
|
|
}
|
|
|
|
[Fact]
|
|
public void TryParseArguments_Without_Args()
|
|
{
|
|
// Act
|
|
var result = WireMockServerSettingsParser.TryParseArguments(new string[] { }, null, out var settings);
|
|
|
|
// Assert
|
|
result.Should().BeTrue();
|
|
settings.Should().NotBeNull();
|
|
settings!.AdminPath.Should().Be("/__admin");
|
|
}
|
|
|
|
[Fact]
|
|
public void TryParseArguments_With_ActivityTracingEnabled_ShouldParseOptions()
|
|
{
|
|
// Act
|
|
var result = WireMockServerSettingsParser.TryParseArguments(new[]
|
|
{
|
|
"--ActivityTracingEnabled", "true",
|
|
"--ActivityTracingExcludeAdminRequests", "false",
|
|
"--ActivityTracingRecordRequestBody", "true",
|
|
"--ActivityTracingRecordResponseBody", "true"
|
|
}, null, out var settings);
|
|
|
|
// Assert
|
|
result.Should().BeTrue();
|
|
settings.Should().NotBeNull();
|
|
settings!.ActivityTracingOptions.Should().NotBeNull();
|
|
settings.ActivityTracingOptions!.ExcludeAdminRequests.Should().BeFalse();
|
|
settings.ActivityTracingOptions.RecordRequestBody.Should().BeTrue();
|
|
settings.ActivityTracingOptions.RecordResponseBody.Should().BeTrue();
|
|
settings.ActivityTracingOptions.RecordMatchDetails.Should().BeTrue();
|
|
}
|
|
} |