mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-05 22:01:33 +00:00
39 lines
893 B
C#
39 lines
893 B
C#
using Xunit;
|
|
|
|
namespace SabreTools.Metadata.Test
|
|
{
|
|
public class ConvertersTests
|
|
{
|
|
#region String to Enum
|
|
|
|
[Theory]
|
|
[InlineData(null, null)]
|
|
[InlineData("INVALID", null)]
|
|
[InlineData("yes", true)]
|
|
[InlineData("True", true)]
|
|
[InlineData("no", false)]
|
|
[InlineData("False", false)]
|
|
public void AsYesNoTest(string? field, bool? expected)
|
|
{
|
|
bool? actual = field.AsYesNo();
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Enum to String
|
|
|
|
[Theory]
|
|
[InlineData(null, null)]
|
|
[InlineData(true, "yes")]
|
|
[InlineData(false, "no")]
|
|
public void FromYesNo(bool? field, string? expected)
|
|
{
|
|
string? actual = field.FromYesNo();
|
|
Assert.Equal(expected, actual);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|