private static void GetRandomStringValues(int numValues, out string[] validStrings, out LargeEnum[] validEnums) { const int max = (int)LargeEnum.OneHundred + 1; validStrings = new string[numValues]; validEnums = new LargeEnum[numValues]; for (int i = 0; i < numValues; ++i) { LargeEnum nextEnum = (LargeEnum)rand.Next(max); validEnums[i] = nextEnum; validStrings[i] = nextEnum.ToString(); } }
public void PerformanceParser_Should_Parse_Each_Item_In_Enum_to_String_Map() { Dictionary <LargeEnum, string> nameToLargeEnumMap; Array values = System.Enum.GetValues(typeof(LargeEnum)); Assert.IsTrue( EnumPerformanceParser.TryCreateEnumToNameMap <LargeEnum>(out nameToLargeEnumMap), "Unable to parse"); Assert.AreEqual(values.Length, nameToLargeEnumMap.Count, "Output doesn't match input size"); for (int i = 0; i < values.Length; ++i) { LargeEnum value = (LargeEnum)values.GetValue(i); Assert.IsTrue( nameToLargeEnumMap.ContainsKey(value), "Value is missing: " + value.ToString()); } }