Unless a call to one of the enum declarations (e.g. TestEnum.One) is made first, the List, FromName and FromValue methods do not always work correctly.
Having added the following tests to SmartEnumFromName
[Fact]
public void ReturnsEnumGivenNoExplicitPriorUse()
{
string expected = "One";
Assert.Equal(expected, TestEnum.FromName(expected).Name);
}
[Fact]
public void ReturnsEnumGivenExplicitPriorUse()
{
string expected = TestEnum.One.Name;
Assert.Equal(expected, TestEnum.FromName(expected).Name);
}
I found that they both pass when running all tests but when run individually, ReturnsEnumGivenNoExplicitPriorUse does not pass. Additionally I found that SmartEnumList.ReturnsAllDefinedSmartEnums also fails when run individually. Thus it seems that the forced invocation code is not working properly. I'll try to figure out why but in the meantime you may also want to take a look.
Unless a call to one of the enum declarations (e.g. TestEnum.One) is made first, the List, FromName and FromValue methods do not always work correctly.
Having added the following tests to
SmartEnumFromNameI found that they both pass when running all tests but when run individually,
ReturnsEnumGivenNoExplicitPriorUsedoes not pass. Additionally I found thatSmartEnumList.ReturnsAllDefinedSmartEnumsalso fails when run individually. Thus it seems that the forced invocation code is not working properly. I'll try to figure out why but in the meantime you may also want to take a look.