We have an enum:
enum Letters
{
A,
B,
C,
D,
E
}
When I try:
var frozenLetter = fixture.Freeze(Letters.D);
Strangely, frozenLetter == A.
var letter = fixture.Create<Letters>();
var anotherLetter = fixture.Create<Letters>();
Letter and anotherLetter both equal A, so the Letters type has been frozen, but to the first constant in the enum rather than the one specified.
Is there a way to freeze an enum to the constant I wish?
private const Letters constLetter = Letters.D;
) at the top of your class and use that instead of creating enums with AutoFixture. – Columbarium