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);
        }
Beispiel #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);
        }
Beispiel #3
0
        public void CompareToThrowsOnNull()
        {
            Pressure pascal = Pressure.FromPascals(1);

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

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            pascal.CompareTo(new object());
        }
Beispiel #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);
        }
Beispiel #6
0
        public void CompareToThrowsOnNull()
        {
            Pressure pascal = Pressure.FromPascals(1);

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

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