public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            return(values.Any(p => Booleany.IsTruthy(p)) ? Visibility.Visible : Visibility.Hidden);
        }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            return(!values.All(p => Booleany.IsTruthy(p)));
        }
Example #3
0
        public void IsTruthy_Check_Decimal_NonZero()
        {
            // arrange
            decimal value = 10m;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #4
0
        public void IsTruthy_Check_Float_NonZero()
        {
            // arrange
            float value = 10f;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #5
0
        public void IsTruthy_Check_UInt_NonZero()
        {
            // arrange
            uint value = 10;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #6
0
        public void IsTruthy_Check_Double_NaN()
        {
            // arrange
            double value = double.NaN;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsFalse(result);
        }
Example #7
0
        public void IsTruthy_Check_UShort_Zero()
        {
            // arrange
            ushort value = 0;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsFalse(result);
        }
Example #8
0
        public void IsTruthy_Check_Boolean_False()
        {
            // arrange
            bool value = false;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsFalse(result);
        }
Example #9
0
        public void IsTruthy_Check_DBNull()
        {
            // arrange
            DBNull value = DBNull.Value;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsFalse(result);
        }
Example #10
0
        public void IsTruthy_Check_IEnumerable_NonEmpty()
        {
            // arrange
            IEnumerable value = GetNonEmptyEnumerable();

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #11
0
        public void IsTruthy_Check_ICollection_NonEmpty()
        {
            // arrange
            ICollection value = new int[] { 1, 2, 3 };

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #12
0
        public void IsTruthy_Check_ICollection_Empty()
        {
            // arrange
            ICollection value = new int[0];

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsFalse(result);
        }
Example #13
0
        public void IsTruthy_Check_Long_NonZero()
        {
            // arrange
            long value = 10L;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #14
0
        public void IsTruthy_Check_Double_NegativeInfinity()
        {
            // arrange
            double value = double.NegativeInfinity;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #15
0
        public void IsTruthy_Check_String_Empty()
        {
            // arrange
            string value = string.Empty;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsFalse(result);
        }
Example #16
0
        public void IsTruthy_Check_String_NonEmpty()
        {
            // arrange
            string value = " ";

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #17
0
        public void IsTruthy_Check_SByte_NonZero()
        {
            // arrange
            sbyte value = 10;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #18
0
        public void IsTruthy_Check_Byte_Zero()
        {
            // arrange
            byte value = 0;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsFalse(result);
        }
Example #19
0
        public void IsTruthy_Check_Object_NotNull()
        {
            // arrange
            object value = new object();

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
Example #20
0
        public void IsTruthy_Check_Double_NonZero()
        {
            // arrange
            double value = 10d;

            // act
            bool result = Booleany.IsTruthy(value);

            // assert
            Assert.IsTrue(result);
        }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(Booleany.IsTruthy(value));
 }
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(Booleany.IsTruthy(value) ? Visibility.Hidden : Visibility.Visible);
 }