public void CompareToIsImplemented()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

            Assert.Equal(0, ohm.CompareTo(ohm));
            Assert.True(ohm.CompareTo(ElectricResistance.Zero) > 0);
            Assert.True(ElectricResistance.Zero.CompareTo(ohm) < 0);
        }
示例#2
0
        public void CompareToIsImplemented()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

            Assert.AreEqual(0, ohm.CompareTo(ohm));
            Assert.Greater(ohm.CompareTo(ElectricResistance.Zero), 0);
            Assert.Less(ElectricResistance.Zero.CompareTo(ohm), 0);
        }
示例#3
0
        public void CompareToThrowsOnNull()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            ohm.CompareTo(null);
        }
示例#4
0
        public void CompareToThrowsOnTypeMismatch()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            ohm.CompareTo(new object());
        }
        public void CompareToThrowsOnNull()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

            Assert.Throws <ArgumentNullException>(() => ohm.CompareTo(null));
        }
        public void CompareToThrowsOnTypeMismatch()
        {
            ElectricResistance ohm = ElectricResistance.FromOhms(1);

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