public void ShouldConvert_StringEquivalentMode() { var result = _converter.ConvertBack("Brawl", typeof(GameMode), null, USCulture); System.Console.WriteLine(result); Assert.AreEqual(GameMode.BRAWL, result); }
public override object ConvertFromString(TypeConverterOptions options, string text) { if (string.IsNullOrEmpty(text)) { return(null); } Type type; switch (options.Format.ToLowerInvariant()) { case "mode": type = typeof(GameMode); break; case "region": type = typeof(Region); break; case "playerclass": type = typeof(PlayerClass); break; case "gameresult": type = typeof(GameResult); break; case "format": type = typeof(GameFormat); break; default: throw new CsvTypeConverterException("Unknown type: " + options.Format); } return(_converter.ConvertBack(text, type, null, options.CultureInfo)); }