Esempio n. 1
0
        public void Chained_none()
        {
            var result = new ChainedParser().Parse("abc", 123);

            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Length);
            Assert.AreEqual("abc", result[0]);
            Assert.AreEqual(123, result[1]);
        }
Esempio n. 2
0
        public void Chained_convert()
        {
            var result = new ChainedParser()
                .Add(new ConvertParser<string, string>())
                .Parse("abc");

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Assert.AreEqual("abc", result[0]);
        }
Esempio n. 3
0
        public void Chained_delimited_convert_revert()
        {
            var result = new ChainedParser()
                .Add(new DelimitedParser(","))
                .Add(new ConvertParser<string, int>())
                .Revert(123, 456, 789);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Length);
            Assert.AreEqual("123,456,789", result[0]);
        }
Esempio n. 4
0
        public void Chained_delimited_convert()
        {
            var result = new ChainedParser()
                .Add(new DelimitedParser(","))
                .Add(new ConvertParser<string, int>())
                .Parse("123, 456, 789");

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Length);
            Assert.AreEqual(123, result[0]);
            Assert.AreEqual(456, result[1]);
            Assert.AreEqual(789, result[2]);
        }