Ejemplo n.º 1
0
        public void ToStringTest()
        {
            var pressure = Pressure.FromPascal(123.456d);

            Assert.AreEqual("123.46 Pa", pressure.ToString());
            Assert.AreEqual("123.456 Pa", pressure.ToString(PressureUnit.Pascal, "{0:F3} {1}"));
            Assert.AreEqual("123,456 Pa", pressure.ToString(PressureUnit.Pascal, new CultureInfo("nl-NL"), "{0:F3} {1}"));
            Assert.AreEqual("123,456", pressure.ToString(PressureUnit.Pascal, new CultureInfo("nl-NL"), "{0:F3}"));
            pressure = Pressure.FromBar(123.456d);
            Assert.AreEqual("123.46 bar", pressure.ToString(PressureUnit.Bar));
            Assert.AreEqual("123.46 bar", pressure.ToString(PressureUnit.Bar, CultureInfo.InvariantCulture));
            Assert.AreEqual("123,46 bar", pressure.ToString(PressureUnit.Bar, new CultureInfo("nl-NL")));
            pressure = Pressure.FromAtmosphere(123.456d);
            Assert.AreEqual("123.46 atm", pressure.ToString(PressureUnit.Atmosphere));
            Assert.AreEqual("123.46 atm", pressure.ToString(PressureUnit.Atmosphere, CultureInfo.InvariantCulture));
            pressure = Pressure.FromPoundsPerSquareInch(123.456d);
            Assert.AreEqual("123.46 psi", pressure.ToString(PressureUnit.Psi));
            Assert.AreEqual("123.46 psi", pressure.ToString(PressureUnit.Psi, CultureInfo.InvariantCulture));
            pressure = Pressure.FromTorr(123.456d);
            Assert.AreEqual("123.46 Torr", pressure.ToString(PressureUnit.Torr));
            Assert.AreEqual("123.46 Torr", pressure.ToString(PressureUnit.Torr, CultureInfo.InvariantCulture));
        }
Ejemplo n.º 2
0
        public void OperatorMinTest()
        {
            var pressure = Pressure.FromPascal(10d) - Pressure.FromAtmosphere(0.00010197162d);

            Assert.AreEqual(0d, pressure.Bar);
        }