I have created two enums and I know they are not the same but still I think it makes sense they would be equal since their string representation as well as their numeral representation are equal (and even the same...).
In other words : I would like the first test to pass and the second one to fail. In reality however, they both fail. So : when are two enums in C# equal? Or is there anyway to define the equals operator in C#?
Thanks!
public enum enumA {one, two}
public enum enumB {one, two}
[Test]
public void PreTest()
{
Assert.AreEqual(enumA.one,enumB.one);
Assert.AreSame(enumA.one, enumB.one);
}
UPDATE : 1) So the answers so far all compare representations, be it ints or strings. The enum itself is always unequal I gather? No means to define equality for it?