public void RoundTrip() { var arr = (ImppTypes[])Enum.GetValues(typeof(ImppTypes)); var list = new List <string>(1); foreach (ImppTypes item in arr) { list.Clear(); ImppTypesCollector.CollectValueStrings(item, list); Assert.AreEqual(1, list.Count); Assert.IsNotNull(list[0]); ImppTypes?comp = ImppTypesConverter.Parse(list[0]); Assert.IsTrue(comp.HasValue); Assert.AreEqual(comp !.Value, item); var comp2 = (ImppTypes)Enum.Parse( typeof(ImppTypes), list[0], true); Assert.AreEqual(comp, comp2); } }
public void ParseTest() { foreach (ImppTypes kind in (ImppTypes[])Enum.GetValues(typeof(ImppTypes))) { ImppTypes?kind2 = ImppTypesConverter.Parse(kind.ToString().ToUpperInvariant()); Assert.AreEqual(kind, kind2); } Assert.IsNull(ImppTypesConverter.Parse("NICHT_VORHANDEN")); Assert.IsNull(ImppTypesConverter.Parse(null)); }