mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-23 09:52:05 +01:00
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
This commit is contained in:
40
test/WireMock.Net.Tests/Extensions/EnumExtensionsTests.cs
Normal file
40
test/WireMock.Net.Tests/Extensions/EnumExtensionsTests.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user