コード例 #1
0
        public void ConvertTest(object value)
        {
            var converterGroup = new ValueConverterGroup();

            converterGroup.Add(new MockConverter());
            converterGroup.Add(new MockConverter());
            converterGroup.Add(new MockConverter());

            var result = converterGroup.Convert(value, typeof(string), null, CultureInfo.CurrentCulture);

            var correctValue = $"{MockConverter.Tag}{MockConverter.Tag}{MockConverter.Tag}{value.ToString()}";

            Assert.AreEqual(correctValue, result);
        }
コード例 #2
0
        public void TautologyTest(bool?input)
        {
            // Arrange
            var group = new ValueConverterGroup();

            group.Converters.Add(new InverseBooleanConverter());
            group.Converters.Add(new InverseBooleanConverter());

            // Act
            var result     = group.Convert(input, typeof(bool), null, CultureInfo.CurrentCulture);
            var resultBack = group.ConvertBack(result, typeof(bool), null, CultureInfo.CurrentCulture);

            // Assert
            Assert.AreEqual(input, result);
            Assert.AreEqual(input, resultBack);
        }
コード例 #3
0
 public void Setup()
 {
     converter = new ValueConverterGroup();
 }