Ejemplo n.º 1
0
        public void ConvertTest_Default()
        {
            var defaultTrueValue  = Visibility.Visible;
            var defaultFalseValue = Visibility.Collapsed;
            var ztvConverter      = new ZeroToNonVisibilityConverter();

            Assert.AreEqual(defaultFalseValue, ztvConverter.Convert(0, typeof(Visibility), null, null));
            Assert.AreEqual(defaultTrueValue, ztvConverter.Convert(13, typeof(Visibility), null, null));
            Assert.AreEqual(defaultTrueValue, ztvConverter.Convert(100, typeof(Visibility), null, null));
        }
Ejemplo n.º 2
0
        public void ConvertTest_DifferentFalseValue()
        {
            var defaultTrueValue = Visibility.Visible;
            var newFalseValue    = Visibility.Hidden;
            var ztvConverter     = new ZeroToNonVisibilityConverter()
            {
                FalseValue = newFalseValue
            };

            Assert.AreEqual(newFalseValue, ztvConverter.Convert(0, typeof(Visibility), null, null));
            Assert.AreEqual(defaultTrueValue, ztvConverter.Convert(100, typeof(Visibility), null, null));
        }
Ejemplo n.º 3
0
        public void ConvertTest_ReverseTrueAndFalseValue()
        {
            var newTrueValue  = Visibility.Visible;
            var newFalseValue = Visibility.Collapsed;
            var ztvConverter  = new ZeroToNonVisibilityConverter()
            {
                TrueValue = newTrueValue, FalseValue = newFalseValue
            };

            Assert.AreEqual(newFalseValue, ztvConverter.Convert(0, typeof(Visibility), null, null));
            Assert.AreEqual(newTrueValue, ztvConverter.Convert(13, typeof(Visibility), null, null));
            Assert.AreEqual(newTrueValue, ztvConverter.Convert(100, typeof(Visibility), null, null));
        }