示例#1
0
        public void FeeRateComparison()
        {
            var a = new FeeRate(Money.Coins(2.0m));
            var b = new FeeRate(Money.Coins(4.0m));

            Assert.True(a < b);
            Assert.True(b > a);
            Assert.False(b < a);
            Assert.False(a > b);
            Assert.True(a != b);
            Assert.True(b != a);

            Assert.True(FeeRate.Min(a, b) == a);
            Assert.True(FeeRate.Min(b, a) == a);
            Assert.True(FeeRate.Max(a, b) == b);
            Assert.True(FeeRate.Max(b, a) == b);

            Assert.True(a.CompareTo(b) < 0);
            Assert.True(b.CompareTo(a) > 0);
            Assert.True(a.CompareTo(a) == 0);
            Assert.True(b.CompareTo(b) == 0);

            var aa = new FeeRate(Money.Coins(2.0m));
            var bb = new FeeRate(Money.Coins(4.0m));
            var o  = new object();

            Assert.True(a == aa);
            Assert.True(a.Equals(aa));
            Assert.False(a.Equals(o));
            Assert.True(b == bb);
            Assert.True(b != aa);
            Assert.True(b != (null as FeeRate));
            Assert.True((null as FeeRate) == (null as FeeRate));
            Assert.False((null as FeeRate) != (null as FeeRate));
            Assert.False(a.Equals(b));
            Assert.True(aa == a);
            Assert.True(bb == b);
        }