Ejemplo n.º 1
0
        public void BoolToInverseConvertTest()
        {
            var converter = new BoolToInverseVisibilityConverter();

            Assert.That(
                converter.Convert(true, typeof(Visibility), null, CultureInfo.CurrentUICulture)
                .Equals(Visibility.Visible));
            Assert.That(
                converter.Convert(false, typeof(Visibility), null, CultureInfo.CurrentUICulture)
                .Equals(Visibility.Collapsed));
        }
        public void Convert(object input, Type targetType, object parameter, string cultureString, object expectedOutput)
        {
            var converter = new BoolToInverseVisibilityConverter();
            var culture   = new CultureInfo(cultureString);
            var output    = converter.Convert(input, targetType, parameter, culture);

            Assert.Equal(expectedOutput, output);
        }
        public void Convert_returns_DependencyPropertyUnsetValue_when_value_null()
        {
            var converter = new BoolToInverseVisibilityConverter();
            var culture   = new CultureInfo("en-US");

#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
            var output = converter.Convert(null, typeof(Visibility), null, culture);
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
            Assert.Equal(DependencyProperty.UnsetValue, output);
        }
Ejemplo n.º 4
0
 public void Convert_True_ReturnsVisible()
 {
     Assert.AreEqual(
         _converter.Convert(true, typeof(Visibility), null, null), Visibility.Visible);
 }