Example #1
0
        public void CompareToIsImplemented()
        {
            FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1);

            Assert.Equal(0, literper100kilometers.CompareTo(literper100kilometers));
            Assert.True(literper100kilometers.CompareTo(FuelEfficiency.Zero) > 0);
            Assert.True(FuelEfficiency.Zero.CompareTo(literper100kilometers) < 0);
        }
Example #2
0
        public void CompareToThrowsOnNull()
        {
            FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1);

            Assert.Throws <ArgumentNullException>(() => literper100kilometers.CompareTo(null));
        }
Example #3
0
        public void CompareToThrowsOnTypeMismatch()
        {
            FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1);

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