Exemplo n.º 1
0
        public void DecimalTruncation()
        {
            var a = new ImpliedDecimal(1234.56m, 2, allowTruncate: true);

            Assert.Equal(12345, a.ToDecimal(1, true));
            Assert.Equal(1234, a.ToDecimal(0, true));
        }
Exemplo n.º 2
0
 public void DecimalTruncationException()
 {
     Assert.Throws(typeof(InvalidOperationException), () =>
     {
         var i = new ImpliedDecimal(1000, 2);
         i.ToDecimal(1, truncate: true);
     });
 }
Exemplo n.º 3
0
        public void DecimalConversion()
        {
            var a = new ImpliedDecimal(10.0m, 2);

            Assert.NotEqual(10.00m, a.Value);
            Assert.Equal(10.00m, (decimal)a);
            Assert.Equal(10.00m, a.ToDecimal());
        }
Exemplo n.º 4
0
        public void EqualityCheck()
        {
            var a = new ImpliedDecimal(10.0m, 2);
            var b = new ImpliedDecimal(10.0m, 2);
            var c = new ImpliedDecimal(10.0m, 4);

            //var d = new ImpliedDecimal(1000m, 2);

            Assert.True(a == b);
            Assert.True(a != c);
            //Assert.True(c != d);
        }