Files
WireMock.Net/test/WireMock.Net.Tests/Extensions/EnumExtensionsTests.cs
Stef Heyenrath 90e017b79a Use dotnet sonar scanner (part 2) (#1125)
* 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
2024-06-20 15:35:37 +02:00

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");
}
}