mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-14 14:23:34 +01:00
* Add TIOBE + include SonarAnalyzer.CSharp * . * cp * Copyright © WireMock.Net * more fixes * fix * xpath * if (Matchers == null || !Matchers.Any()) * if (Matchers != null) * ? * . * .
42 lines
950 B
C#
42 lines
950 B
C#
// Copyright © WireMock.Net
|
|
|
|
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");
|
|
}
|
|
} |