mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-25 03:34:58 +01:00
* ddd * ---ddd * f * revert * /d:sonar.branch.name=$(Build.SourceBranchName) * FIX * coverlet * coverlet - 1 line * dotnet-coverage * --configuration Debug --no-build --framework net8.0 * script * /d: * collect? * "wiremock-coverage.xml" * see * tests
40 lines
920 B
C#
40 lines
920 B
C#
using System;
|
|
using FluentAssertions;
|
|
using WireMock.Extensions;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.Extensions;
|
|
|
|
public class EnumExtensionsTests
|
|
{
|
|
private enum TestEnum
|
|
{
|
|
Value1
|
|
}
|
|
|
|
[Fact]
|
|
public void EnumExtensions_GetFullyQualifiedEnumValue_ShouldReturnCorrectValue()
|
|
{
|
|
// Arrange
|
|
var enumValue = TestEnum.Value1;
|
|
|
|
// Act
|
|
var result = enumValue.GetFullyQualifiedEnumValue();
|
|
|
|
// Assert
|
|
result.Should().Be("WireMock.Net.Tests.Extensions.TestEnum.Value1");
|
|
}
|
|
|
|
[Fact]
|
|
public void EnumExtensions_GetFullyQualifiedEnumValue_ShouldThrowArgumentException_WhenTypeIsNotEnum()
|
|
{
|
|
// Arrange
|
|
int nonEnumValue = 42;
|
|
|
|
// Act
|
|
Action act = () => nonEnumValue.GetFullyQualifiedEnumValue();
|
|
|
|
// Assert
|
|
act.Should().Throw<ArgumentException>().WithMessage("T must be an enum");
|
|
}
|
|
} |