コード例 #1
0
            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]);
            }
コード例 #2
0
            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]);
            }
コード例 #3
0
 public void Converter_Throws_Exceptions_When_Specified()
 {
     Assert.Throws <FormatException>(() => PartlyInvalidIntStringCollection.ToArray <int>(false, true));
 }