public void Converter_Suppresses_Exceptions_By_Default() { IList <int> result = PartlyInvalidIntStringCollection.ToList <int>(true); Assert.AreEqual(4, result.Count); Assert.AreEqual(8, result[0]); Assert.AreEqual(2, result[1]); Assert.AreEqual(6, result[2]); Assert.AreEqual(4, result[3]); }
public void Custom_Parser_Ignores_NonParsing_Values() { IList <int> result = PartlyInvalidIntStringCollection.ToList <int>(int.TryParse); Assert.AreEqual(5, result.Count); Assert.AreEqual(8, result[0]); Assert.AreEqual(2, result[1]); Assert.AreEqual(6, result[2]); Assert.AreEqual(2, result[3]); Assert.AreEqual(4, result[4]); }
public void Converter_Throws_Exceptions_When_Specified() { Assert.Throws <FormatException>(() => PartlyInvalidIntStringCollection.ToList <int>(false, true)); }