コード例 #1
0
        public void Abst_ShouldReturnAbsoluteValues()
        {
            // Arrange
            sbyte   aByte    = -10;
            short   aShort   = -20;
            int     aInt     = -30;
            long    aLong    = -40;
            float   aFloat   = -50.0F;
            double  aDouble  = -60.0;
            decimal aDecimal = (decimal) - 70.0;


            // Act

            short   absByte    = aByte.Abs();
            short   absShort   = aShort.Abs();
            int     absInt     = aInt.Abs();
            long    absLong    = aLong.Abs();
            float   absFloat   = aFloat.Abs();
            double  absDouble  = aDouble.Abs();
            decimal absDecimal = aDecimal.Abs();

            // Assert
            Assert.Equal(10, absByte);
            Assert.Equal(20, absShort);
            Assert.Equal(30, absInt);
            Assert.Equal(40, absLong);
            Assert.Equal(50, absFloat);
            Assert.Equal(60, absDouble);
            Assert.Equal(70, absDecimal);
        }