mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-18 07:24:34 +01:00
* Version 2.x * Setup .NET 9 * 12 * cleanup some #if for NETSTANDARD1_3 * cleanup + fix tests for net8 * openapi * NO ConfigureAwait(false) + cleanup * . * #endif * HashSet * WireMock.Net.NUnit * HttpContext * Add WebSockets (#1423) * Add WebSockets * Add tests * fix * more tests * Add tests * ... * remove IOwin * - * tests * fluent * ok * match * . * byte[] * x * func * func * byte * trans * ... * frameworks......... * jmes * xxx * sc * using var httpClient = new HttpClient(); * usings * maxRetries * up * xunit v3 * ct * --- * ct * ct2 * T Unit * WireMock.Net.TUnitTests / 10 * t unit first * --project * no tunit * t2 * --project * --project * ci - --project * publish ./test/wiremock-coverage.xml * windows * . * log * ... * log * goed * BodyType * . * . * --scenario * ... * pact * ct * . * WireMock.Net.RestClient.AwesomeAssertions (#1427) * WireMock.Net.RestClient.AwesomeAssertions * ok * atpath * fix test * sonar fixes * ports * proxy test * FIX? * --- * await Task.Delay(100, _ct); * ? * --project * Aspire: use IDistributedApplicationEventingSubscriber (#1428) * broadcast * ok * more tsts * . * Collection * up * . * 2 * remove nfluent * <VersionPrefix>2.0.0-preview-02</VersionPrefix> * ... * . * nuget icon * . * <PackageReference Include="JmesPath.Net" Version="1.1.0" /> * x * 500 * . * fix some warnings * ws
80 lines
2.0 KiB
C#
80 lines
2.0 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using System.Globalization;
|
|
using WireMock.Util;
|
|
|
|
namespace WireMock.Net.Tests.Util;
|
|
|
|
public class CultureInfoUtilsTests
|
|
{
|
|
[Theory]
|
|
[InlineData(null, typeof(CultureInfo))]
|
|
[InlineData("en-US", typeof(CultureInfo))]
|
|
[InlineData("fr-FR", typeof(CultureInfo))]
|
|
[InlineData("es-ES", typeof(CultureInfo))]
|
|
public void Parse_ValidInputs_ReturnsExpectedCultureInfo(string? value, Type expectedType)
|
|
{
|
|
// Act
|
|
var result = CultureInfoUtils.Parse(value);
|
|
|
|
// Assert
|
|
result.Should().BeOfType(expectedType);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("InvalidCulture")]
|
|
[InlineData("123456")]
|
|
public void Parse_InvalidInputs_ReturnsCurrentCulture(string? value)
|
|
{
|
|
// Arrange
|
|
var expectedCulture = CultureInfo.CurrentCulture;
|
|
|
|
// Act
|
|
var result = CultureInfoUtils.Parse(value);
|
|
|
|
// Assert
|
|
result.Should().Be(expectedCulture);
|
|
}
|
|
|
|
[Fact]
|
|
public void Parse_IntegerInput_ReturnsExpectedCultureInfo()
|
|
{
|
|
// Arrange
|
|
string value = "1033"; // en-US culture identifier
|
|
var expectedCulture = new CultureInfo(1033);
|
|
|
|
// Act
|
|
var result = CultureInfoUtils.Parse(value);
|
|
|
|
// Assert
|
|
result.Should().Be(expectedCulture);
|
|
}
|
|
|
|
[Fact]
|
|
public void Parse_CurrentCultureInput_ReturnsCurrentCulture()
|
|
{
|
|
// Arrange
|
|
string value = nameof(CultureInfo.CurrentCulture);
|
|
var expectedCulture = CultureInfo.CurrentCulture;
|
|
|
|
// Act
|
|
var result = CultureInfoUtils.Parse(value);
|
|
|
|
// Assert
|
|
result.Should().Be(expectedCulture);
|
|
}
|
|
|
|
[Fact]
|
|
public void Parse_InvariantCultureInput_ReturnsInvariantCulture()
|
|
{
|
|
// Arrange
|
|
string value = nameof(CultureInfo.InvariantCulture);
|
|
var expectedCulture = CultureInfo.InvariantCulture;
|
|
|
|
// Act
|
|
var result = CultureInfoUtils.Parse(value);
|
|
|
|
// Assert
|
|
result.Should().Be(expectedCulture);
|
|
}
|
|
} |