예제 #1
0
        public void CompareToIsImplemented()
        {
            Pressure pascal = Pressure.FromPascals(1);

            Assert.Equal(0, pascal.CompareTo(pascal));
            Assert.True(pascal.CompareTo(Pressure.Zero) > 0);
            Assert.True(Pressure.Zero.CompareTo(pascal) < 0);
        }
예제 #2
0
        public void CompareToIsImplemented()
        {
            Pressure pascal = Pressure.FromPascals(1);

            Assert.AreEqual(0, pascal.CompareTo(pascal));
            Assert.Greater(pascal.CompareTo(Pressure.Zero), 0);
            Assert.Less(Pressure.Zero.CompareTo(pascal), 0);
        }
예제 #3
0
        public void CompareToThrowsOnNull()
        {
            Pressure pascal = Pressure.FromPascals(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            pascal.CompareTo(null);
        }
예제 #4
0
        public void CompareToThrowsOnTypeMismatch()
        {
            Pressure pascal = Pressure.FromPascals(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            pascal.CompareTo(new object());
        }
예제 #5
0
        public void Compare()
        {
            Pressure a = Pressure.FromHectopascal(950.21);
            Pressure b = Pressure.FromHectopascal(920.59);
            Pressure c = Pressure.FromPascal(95021);

            Assert.NotEqual(a, b);
            Assert.True(a != b);
            Assert.True(a.CompareTo(b) > 0);
            Assert.True(a == c);
            Assert.True(b < a);
            Assert.True(a > b);
            Assert.True(a >= c);
            Assert.True(a <= c);
            Assert.False(a < b);
        }
예제 #6
0
        public void CompareToThrowsOnNull()
        {
            Pressure pascal = Pressure.FromPascals(1);

            Assert.Throws <ArgumentNullException>(() => pascal.CompareTo(null));
        }
예제 #7
0
        public void CompareToThrowsOnTypeMismatch()
        {
            Pressure pascal = Pressure.FromPascals(1);

            Assert.Throws <ArgumentException>(() => pascal.CompareTo(new object()));
        }