コード例 #1
0
        public void ConversionRoundTrip()
        {
            MolarMass kilogrampermole = MolarMass.FromKilogramsPerMole(1);

            AssertEx.EqualTolerance(1, MolarMass.FromCentigramsPerMole(kilogrampermole.CentigramsPerMole).KilogramsPerMole, CentigramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromDecagramsPerMole(kilogrampermole.DecagramsPerMole).KilogramsPerMole, DecagramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromDecigramsPerMole(kilogrampermole.DecigramsPerMole).KilogramsPerMole, DecigramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromGramsPerMole(kilogrampermole.GramsPerMole).KilogramsPerMole, GramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromHectogramsPerMole(kilogrampermole.HectogramsPerMole).KilogramsPerMole, HectogramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromKilogramsPerMole(kilogrampermole.KilogramsPerMole).KilogramsPerMole, KilogramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromKilopoundsPerMole(kilogrampermole.KilopoundsPerMole).KilogramsPerMole, KilopoundsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromMegapoundsPerMole(kilogrampermole.MegapoundsPerMole).KilogramsPerMole, MegapoundsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromMicrogramsPerMole(kilogrampermole.MicrogramsPerMole).KilogramsPerMole, MicrogramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromMilligramsPerMole(kilogrampermole.MilligramsPerMole).KilogramsPerMole, MilligramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromNanogramsPerMole(kilogrampermole.NanogramsPerMole).KilogramsPerMole, NanogramsPerMoleTolerance);
            AssertEx.EqualTolerance(1, MolarMass.FromPoundsPerMole(kilogrampermole.PoundsPerMole).KilogramsPerMole, PoundsPerMoleTolerance);
        }
コード例 #2
0
 public void NumberToMilligramsPerMoleTest() =>
 Assert.Equal(MolarMass.FromMilligramsPerMole(2), 2.MilligramsPerMole());
コード例 #3
0
 /// <inheritdoc cref="MolarMass.FromMilligramsPerMole(double?)"/>
 public static MolarMass?MilligramsPerMole(this decimal?value) => MolarMass.FromMilligramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value));
コード例 #4
0
 /// <inheritdoc cref="MolarMass.FromMilligramsPerMole(double)"/>
 public static MolarMass MilligramsPerMole(this decimal value) => MolarMass.FromMilligramsPerMole(Convert.ToDouble(value));
コード例 #5
0
 /// <inheritdoc cref="MolarMass.FromMilligramsPerMole(double?)"/>
 public static MolarMass?MilligramsPerMole(this float?value) => MolarMass.FromMilligramsPerMole(value);
コード例 #6
0
 /// <inheritdoc cref="MolarMass.FromMilligramsPerMole(double)"/>
 public static MolarMass MilligramsPerMole(this double value) => MolarMass.FromMilligramsPerMole(value);
コード例 #7
0
 public static MolarMass?MilligramsPerMole <T>(this T?value) where T : struct => MolarMass.FromMilligramsPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value));
コード例 #8
0
 public static MolarMass MilligramsPerMole <T>(this T value) =>
 MolarMass.FromMilligramsPerMole(Convert.ToDecimal(value));