mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-22 08:48:46 +02:00
Include WireMockOpenApiParser project (#916)
* Fix some nullability warnings for WireMockOpenApiParser * . * . * . * opt * FromText * ab * . * private const string AdminOpenApi = "/__admin/openapi"; * fix test * rnd * . * urldetails * 0 * , * . * tests * . * CompressionUtilsTests * ut * .
This commit is contained in:
83
test/WireMock.Net.Tests/Util/CultureInfoUtilsTests.cs
Normal file
83
test/WireMock.Net.Tests/Util/CultureInfoUtilsTests.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using FluentAssertions;
|
||||
using WireMock.Util;
|
||||
using Xunit;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#if !NETSTANDARD1_3
|
||||
[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);
|
||||
}
|
||||
#endif
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user