public void GetHashCode_should_return_value_for_enums()
        {
            var instance = new EnumClass(3, 6);

            var result = instance.GetHashCode();

            Assert.NotEqual(0, result);
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor to add a new named item to the enumeration.
 /// </summary>
 ///
 /// <param name="name">the name of the enum object,must not be empty or <c>null</c></param>
 /// <exception cref="IllegalArgumentException if the name is <c>null</c>or an empty string"/>
 /// <exception cref="IllegalArgumentException if the getEnumClass() method returnsa null or invalid Class"/>
 protected internal Enum(String name) : base()
 {
     if (name == null)
     {
         //allow the enum class to be forcibly loaded. See method forciblyLoadClass.
     }
     else
     {
         this.iToString = null;
         Init(name);
         iName     = name;
         iHashCode = 7 + EnumClass.GetHashCode() + 3 * name.GetHashCode();
         // cannot create toString here as subclasses may want to include other data
     }
 }