public void Converter_Suppresses_Exceptions_By_Default() { int[] result = PartlyInvalidIntStringCollection.ToArray <int>(true); Assert.AreEqual(4, result.Length); 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() { int[] result = PartlyInvalidIntStringCollection.ToArray <int>(int.TryParse); Assert.AreEqual(5, result.Length); 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.ToArray <int>(false, true)); }