IsZero() 공개 정적인 메소드

Is the supplied number equal to zero (0)?
public static IsZero ( object number ) : bool
number object The number to check.
리턴 bool
예제 #1
0
        public void IsZero()
        {
            Assert.IsFalse(NumberUtils.IsZero((short)2));
            Assert.IsTrue(NumberUtils.IsZero((short)0));

            Assert.IsFalse(NumberUtils.IsZero(2));
            Assert.IsTrue(NumberUtils.IsZero(0));

            Assert.IsFalse(NumberUtils.IsZero((long)2));
            Assert.IsTrue(NumberUtils.IsZero((long)0));

            Assert.IsFalse(NumberUtils.IsZero((ushort)2));
            Assert.IsTrue(NumberUtils.IsZero((ushort)0));

            Assert.IsFalse(NumberUtils.IsZero((uint)2));
            Assert.IsTrue(NumberUtils.IsZero((uint)0));

            Assert.IsFalse(NumberUtils.IsZero((ulong)2));
            Assert.IsTrue(NumberUtils.IsZero((ulong)0));

            Assert.IsFalse(NumberUtils.IsZero((decimal)2));
            Assert.IsTrue(NumberUtils.IsZero((decimal)0));

            Assert.IsTrue(NumberUtils.IsZero((byte?)0));
            Assert.IsFalse(NumberUtils.IsZero((byte)2));

            Assert.IsTrue(NumberUtils.IsZero((sbyte?)0));
            Assert.IsFalse(NumberUtils.IsZero((sbyte)2));
        }
예제 #2
0
        public void IsZero()
        {
            Assert.IsFalse(NumberUtils.IsZero((Int16)2));
            Assert.IsTrue(NumberUtils.IsZero((Int16)0));

            Assert.IsFalse(NumberUtils.IsZero((Int32)2));
            Assert.IsTrue(NumberUtils.IsZero((Int32)0));

            Assert.IsFalse(NumberUtils.IsZero((Int64)2));
            Assert.IsTrue(NumberUtils.IsZero((Int64)0));

            Assert.IsFalse(NumberUtils.IsZero((UInt16)2));
            Assert.IsTrue(NumberUtils.IsZero((UInt16)0));

            Assert.IsFalse(NumberUtils.IsZero((UInt32)2));
            Assert.IsTrue(NumberUtils.IsZero((UInt32)0));

            Assert.IsFalse(NumberUtils.IsZero((UInt64)2));
            Assert.IsTrue(NumberUtils.IsZero((UInt64)0));

            Assert.IsFalse(NumberUtils.IsZero((decimal)2));
            Assert.IsTrue(NumberUtils.IsZero((decimal)0));

            Assert.IsTrue(NumberUtils.IsZero((Byte?)0));
            Assert.IsFalse(NumberUtils.IsZero((Byte)2));

            Assert.IsTrue(NumberUtils.IsZero((SByte?)0));
            Assert.IsFalse(NumberUtils.IsZero((SByte)2));
        }