public void TestStaticGetStringValue( ) { //Expect to retrieve a string value Assert.AreEqual(("CX" == StringEnum.GetStringValue(REGISTERS_WithStrings.CX))); //No string value to retrieve Assert.IsNull(StringEnum.GetStringValue(REGISTERS_WithNoStrings.DX) == null); //String values exist but not for this enum value Assert.IsNull(StringEnum.GetStringValue(REGISTERS_WithPartialStrings.DI) == null); }
/// <summary> /// Tests GetStringValue caching (Static implementation) /// </summary> public void TestStaticGetStringValueCaching( ) { //Expect to retrieve a string value (and cache this value) Assert.AreEqual(("CX" == StringEnum.GetStringValue(REGISTERS_WithStrings.CX))); //Expect to retrieve a different value (as this is from a different enum) Assert.AreEqual(("Cx" == StringEnum.GetStringValue(REGISTERS_WithDifferentStrings.CX))); //Expect to retrieve both values again (cached) Assert.AreEqual(("CX" == StringEnum.GetStringValue(REGISTERS_WithStrings.CX))); Assert.AreEqual(("Cx" == StringEnum.GetStringValue(REGISTERS_WithDifferentStrings.CX))); }