Ejemplo n.º 1
0
        public void NullConverterAddException()
        {
            var mergedConverter = new MergedElementConverter(new ParagraphConverter());

            var ex = Assert.Throws <ArgumentNullException>(() =>
            {
                mergedConverter.Add(typeof(string), null);
            });

            Assert.Equal("converter", ex.ParamName);
        }
Ejemplo n.º 2
0
        public void NullTypeAddException()
        {
            var mergedConverter = new MergedElementConverter(new ParagraphConverter());

            var ex = Assert.Throws <ArgumentNullException>(() =>
            {
                mergedConverter.Add(null, new StringConverter());
            });

            Assert.Equal("converterSourceType", ex.ParamName);
        }
Ejemplo n.º 3
0
        public void ParagraphToInt()
        {
            var paragraph       = Paragraph.FromText("123");
            var mergedConverter = new MergedElementConverter(new ParagraphConverter());

            mergedConverter.Add(typeof(string), new StringConverter());

            var value = mergedConverter.Convert(paragraph, typeof(int));

            Assert.IsType <int>(value);
            var intValue = (int)value;

            Assert.Equal(123, intValue);
        }