Exemplo n.º 1
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.CentigramPerMole).CentigramsPerMole, CentigramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecagramPerMole).DecagramsPerMole, DecagramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.DecigramPerMole).DecigramsPerMole, DecigramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.GramPerMole).GramsPerMole, GramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.HectogramPerMole).HectogramsPerMole, HectogramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilogramPerMole).KilogramsPerMole, KilogramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.KilopoundPerMole).KilopoundsPerMole, KilopoundsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MegapoundPerMole).MegapoundsPerMole, MegapoundsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MicrogramPerMole).MicrogramsPerMole, MicrogramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.MilligramPerMole).MilligramsPerMole, MilligramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.NanogramPerMole).NanogramsPerMole, NanogramsPerMoleTolerance);
     AssertEx.EqualTolerance(1, MolarMass.From(1, MolarMassUnit.PoundPerMole).PoundsPerMole, PoundsPerMoleTolerance);
 }
Exemplo n.º 2
0
        public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
        {
            var quantity00 = MolarMass.From(1, MolarMassUnit.CentigramPerMole);

            AssertEx.EqualTolerance(1, quantity00.CentigramsPerMole, CentigramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.CentigramPerMole, quantity00.Unit);

            var quantity01 = MolarMass.From(1, MolarMassUnit.DecagramPerMole);

            AssertEx.EqualTolerance(1, quantity01.DecagramsPerMole, DecagramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.DecagramPerMole, quantity01.Unit);

            var quantity02 = MolarMass.From(1, MolarMassUnit.DecigramPerMole);

            AssertEx.EqualTolerance(1, quantity02.DecigramsPerMole, DecigramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.DecigramPerMole, quantity02.Unit);

            var quantity03 = MolarMass.From(1, MolarMassUnit.GramPerMole);

            AssertEx.EqualTolerance(1, quantity03.GramsPerMole, GramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.GramPerMole, quantity03.Unit);

            var quantity04 = MolarMass.From(1, MolarMassUnit.HectogramPerMole);

            AssertEx.EqualTolerance(1, quantity04.HectogramsPerMole, HectogramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.HectogramPerMole, quantity04.Unit);

            var quantity05 = MolarMass.From(1, MolarMassUnit.KilogramPerMole);

            AssertEx.EqualTolerance(1, quantity05.KilogramsPerMole, KilogramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.KilogramPerMole, quantity05.Unit);

            var quantity06 = MolarMass.From(1, MolarMassUnit.KilopoundPerMole);

            AssertEx.EqualTolerance(1, quantity06.KilopoundsPerMole, KilopoundsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.KilopoundPerMole, quantity06.Unit);

            var quantity07 = MolarMass.From(1, MolarMassUnit.MegapoundPerMole);

            AssertEx.EqualTolerance(1, quantity07.MegapoundsPerMole, MegapoundsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.MegapoundPerMole, quantity07.Unit);

            var quantity08 = MolarMass.From(1, MolarMassUnit.MicrogramPerMole);

            AssertEx.EqualTolerance(1, quantity08.MicrogramsPerMole, MicrogramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.MicrogramPerMole, quantity08.Unit);

            var quantity09 = MolarMass.From(1, MolarMassUnit.MilligramPerMole);

            AssertEx.EqualTolerance(1, quantity09.MilligramsPerMole, MilligramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.MilligramPerMole, quantity09.Unit);

            var quantity10 = MolarMass.From(1, MolarMassUnit.NanogramPerMole);

            AssertEx.EqualTolerance(1, quantity10.NanogramsPerMole, NanogramsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.NanogramPerMole, quantity10.Unit);

            var quantity11 = MolarMass.From(1, MolarMassUnit.PoundPerMole);

            AssertEx.EqualTolerance(1, quantity11.PoundsPerMole, PoundsPerMoleTolerance);
            Assert.Equal(MolarMassUnit.PoundPerMole, quantity11.Unit);
        }