Beispiel #1
0
        public static void MultiUnitConversions()
        {
            Assert.Equal(1.2f, MpS.FromMpS(MpS.FromKpH(1.2f), true), RequestedAccuracy);
            Assert.Equal(1.2f, MpS.FromMpS(MpS.FromMpH(1.2f), false), RequestedAccuracy);
            Assert.Equal(1.2f, MpS.ToMpS(MpS.ToKpH(1.2f), true), RequestedAccuracy);
            Assert.Equal(1.2f, MpS.ToMpS(MpS.ToMpH(1.2f), false), RequestedAccuracy);

            Assert.Equal(1.2f, KPa.FromKPa(1.2f, PressureUnit.KPa), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.FromBar(KPa.FromKPa(1.2f, PressureUnit.Bar)), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.FromInHg(KPa.FromKPa(1.2f, PressureUnit.InHg)), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.FromKgfpCm2(KPa.FromKPa(1.2f, PressureUnit.KgfpCm2)), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.FromPSI(KPa.FromKPa(1.2f, PressureUnit.PSI)), RequestedAccuracy);
            Assert.Throws <ArgumentOutOfRangeException>(() => KPa.FromKPa(1.2f, PressureUnit.None));

            Assert.Equal(1.2f, KPa.ToKPa(1.2f, PressureUnit.KPa), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.ToBar(KPa.ToKPa(1.2f, PressureUnit.Bar)), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.ToInHg(KPa.ToKPa(1.2f, PressureUnit.InHg)), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.ToKgfpCm2(KPa.ToKPa(1.2f, PressureUnit.KgfpCm2)), RequestedAccuracy);
            Assert.Equal(1.2f, KPa.ToPSI(KPa.ToKPa(1.2f, PressureUnit.PSI)), RequestedAccuracy);
            Assert.Throws <ArgumentOutOfRangeException>(() => KPa.ToKPa(1.2f, PressureUnit.None));
        }