Exemplo n.º 1
0
        public void NumericToBooleanConverter()
        {
            NumericToBooleanConverter converter = new NumericToBooleanConverter();

            Assert.AreEqual(false, converter.Convert(0, null, null, null));
            Assert.AreEqual(true, converter.Convert(-1, null, null, null));
            Assert.AreEqual(true, converter.Convert(1, null, null, null));
            Assert.AreEqual(true, converter.Convert(2, null, null, null));
        }
Exemplo n.º 2
0
        public void NotZeroBooleanConverter()
        {
            var converter = new NumericToBooleanConverter();

            Assert.AreEqual(false, converter.Convert(null, typeof(bool), null, null));
            Assert.AreEqual(false, converter.Convert(0, typeof(bool), null, null));
            Assert.AreEqual(false, converter.Convert(0f, typeof(bool), null, null));
            Assert.AreEqual(false, converter.Convert(0d, typeof(bool), null, null));
            Assert.AreEqual(true, converter.Convert(10, typeof(bool), null, null));
            Assert.AreEqual(true, converter.Convert(-10, typeof(bool), null, null));
            Assert.AreEqual(true, converter.Convert(5d, typeof(bool), null, null));
        }