예제 #1
0
        public void CompareToIsImplemented()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

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

            Assert.AreEqual(0, volt.CompareTo(volt));
            Assert.Greater(volt.CompareTo(ElectricPotential.Zero), 0);
            Assert.Less(ElectricPotential.Zero.CompareTo(volt), 0);
        }
예제 #3
0
        public void CompareToThrowsOnNull()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            volt.CompareTo(null);
        }
예제 #4
0
        public void CompareToThrowsOnTypeMismatch()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

// ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            volt.CompareTo(new object());
        }
예제 #5
0
        public void CompareToThrowsOnNull()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

            Assert.Throws <ArgumentNullException>(() => volt.CompareTo(null));
        }
예제 #6
0
        public void CompareToThrowsOnTypeMismatch()
        {
            ElectricPotential volt = ElectricPotential.FromVolts(1);

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