Ejemplo n.º 1
0
        public void ThrowsWithoutUnderlyingConverter()
        {
            var invertingConverter = new InvertingConverter();

            Assert.Throws <InvalidOperationException>(() => invertingConverter.Convert(
                                                          new object(), typeof(object), null, CultureInfo.CurrentCulture));

            Assert.Throws <InvalidOperationException>(() => invertingConverter.ConvertBack(
                                                          new object(), typeof(object), null, CultureInfo.CurrentCulture));
        }
Ejemplo n.º 2
0
        public void InvertsOtherConverter()
        {
            IValueConverter normalConverter    = new IntToStringConverter();
            var             invertingConverter = new InvertingConverter(normalConverter);

            const int    convertValue     = 123;
            const string convertBackValue = "123";

            Assert.Equal(
                normalConverter.Convert(convertValue, typeof(string), null, null),
                invertingConverter.ConvertBack(convertValue, typeof(string), null, null));
            Assert.Equal(
                normalConverter.ConvertBack(convertBackValue, typeof(string), null, null),
                invertingConverter.Convert(convertBackValue, typeof(string), null, null));
        }