Ejemplo n.º 1
0
        public void ConversionRoundTrip()
        {
            FuelEfficiency literper100kilometers = FuelEfficiency.FromLitersPer100Kilometers(1);

            AssertEx.EqualTolerance(1, FuelEfficiency.FromKilometersPerLiters(literper100kilometers.KilometersPerLiters).LitersPer100Kilometers, KilometersPerLitersTolerance);
            AssertEx.EqualTolerance(1, FuelEfficiency.FromLitersPer100Kilometers(literper100kilometers.LitersPer100Kilometers).LitersPer100Kilometers, LitersPer100KilometersTolerance);
            AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUkGallon(literper100kilometers.MilesPerUkGallon).LitersPer100Kilometers, MilesPerUkGallonTolerance);
            AssertEx.EqualTolerance(1, FuelEfficiency.FromMilesPerUsGallon(literper100kilometers.MilesPerUsGallon).LitersPer100Kilometers, MilesPerUsGallonTolerance);
        }
Ejemplo n.º 2
0
 public static FuelEfficiency MilesPerUsGallon <T>(this T value) =>
 FuelEfficiency.FromMilesPerUsGallon(Convert.ToDecimal(value));
Ejemplo n.º 3
0
 public void NumberToMilesPerUsGallonTest() =>
 Assert.Equal(FuelEfficiency.FromMilesPerUsGallon(2), 2.MilesPerUsGallon());