Пример #1
0
 /// <summary>
 /// Test whether a given string is defined within the given enum
 /// </summary>
 public void TestStaticIsStringDefined( )
 {
     Assert.IsFalse(StringEnum.IsStringDefined(typeof(REGISTERS_WithStrings), "DI") == false);
     Assert.IsTrue(StringEnum.IsStringDefined(typeof(REGISTERS_WithPartialStrings), "RnD sTr", true) == true);
 }
Пример #2
0
 /// <summary>
 /// Parse a string value to retrieve an enum value
 /// </summary>
 public void TestStaticParse( )
 {
     //Case Sensitive (not found)
     Assert.IsNull(StringEnum.Parse(typeof(REGISTERS_WithPartialStrings), "RnD sTr") == null);
     //Case Sensitive (found)
     Assert.AreEqual(REGISTERS_WithPartialStrings.SP == ( REGISTERS_WithPartialStrings)StringEnum.Parse(typeof(REGISTERS_WithPartialStrings), "RND STR"));
     //Case insensitive (found)
     Assert.AreEqual(REGISTERS_WithPartialStrings.SP == (REGISTERS_WithPartialStrings)StringEnum.Parse(typeof(REGISTERS_WithPartialStrings), "RnD sTr", true));
 }