I just noticed that you can create something like this in C#:
enum TestEnum
{
First = 1,
Second = 1,
Third = 2
}
[TestMethod]
public void Test()
{
TestEnum test = TestEnum.First;
var en = (TestEnum) 1;//And en is now set to First
}
We would like the enums value to be unique. Right now, I have written a unit test that checks that each value is only used once in our enum. Is there a better way to force the uniqueness?