Beispiel #1
0
        public void ConversionRoundTrip()
        {
            DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1);

            Assert.AreEqual(1, DynamicViscosity.FromCentipoise(newtonsecondpermetersquared.Centipoise).NewtonSecondsPerMeterSquared, CentipoiseTolerance);
            Assert.AreEqual(1, DynamicViscosity.FromMillipascalSeconds(newtonsecondpermetersquared.MillipascalSeconds).NewtonSecondsPerMeterSquared, MillipascalSecondsTolerance);
            Assert.AreEqual(1, DynamicViscosity.FromNewtonSecondsPerMeterSquared(newtonsecondpermetersquared.NewtonSecondsPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance);
            Assert.AreEqual(1, DynamicViscosity.FromPascalSeconds(newtonsecondpermetersquared.PascalSeconds).NewtonSecondsPerMeterSquared, PascalSecondsTolerance);
            Assert.AreEqual(1, DynamicViscosity.FromPoise(newtonsecondpermetersquared.Poise).NewtonSecondsPerMeterSquared, PoiseTolerance);
        }
Beispiel #2
0
        public void ConversionRoundTrip()
        {
            DynamicViscosity newtonsecondpermetersquared = DynamicViscosity.FromNewtonSecondsPerMeterSquared(1);

            AssertEx.EqualTolerance(1, DynamicViscosity.FromCentipoise(newtonsecondpermetersquared.Centipoise).NewtonSecondsPerMeterSquared, CentipoiseTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromMicropascalSeconds(newtonsecondpermetersquared.MicropascalSeconds).NewtonSecondsPerMeterSquared, MicropascalSecondsTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromMillipascalSeconds(newtonsecondpermetersquared.MillipascalSeconds).NewtonSecondsPerMeterSquared, MillipascalSecondsTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromNewtonSecondsPerMeterSquared(newtonsecondpermetersquared.NewtonSecondsPerMeterSquared).NewtonSecondsPerMeterSquared, NewtonSecondsPerMeterSquaredTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromPascalSeconds(newtonsecondpermetersquared.PascalSeconds).NewtonSecondsPerMeterSquared, PascalSecondsTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromPoise(newtonsecondpermetersquared.Poise).NewtonSecondsPerMeterSquared, PoiseTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromPoundsForceSecondPerSquareFoot(newtonsecondpermetersquared.PoundsForceSecondPerSquareFoot).NewtonSecondsPerMeterSquared, PoundsForceSecondPerSquareFootTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromPoundsForceSecondPerSquareInch(newtonsecondpermetersquared.PoundsForceSecondPerSquareInch).NewtonSecondsPerMeterSquared, PoundsForceSecondPerSquareInchTolerance);
            AssertEx.EqualTolerance(1, DynamicViscosity.FromReyns(newtonsecondpermetersquared.Reyns).NewtonSecondsPerMeterSquared, ReynsTolerance);
        }
    //public PhaseEnvelopeData get_phase_envelope_data()
    //{
    //    PhaseEnvelopeData ret = new PhaseEnvelopeData(CoolPropPINVOKE.AbstractState_get_phase_envelope_data(swigCPtr), false);
    //    if (CoolPropPINVOKE.SWIGPendingException.Pending) throw CoolPropPINVOKE.SWIGPendingException.Retrieve();
    //    return ret;
    //}


    public DynamicViscosity viscosity()
    {
        double localVis = 0;

        if (Environment.Is64BitProcess)
        {
            localVis = CoolPropPINVOKE64.AbstractState_viscosity(swigCPtr);
        }
        else
        {
            localVis = CoolPropPINVOKE.AbstractState_viscosity(swigCPtr);
        }


        if (double.IsNaN(localVis) || localVis < (double)Decimal.MinValue || localVis > (double)Decimal.MaxValue)
        {
            return(DynamicViscosity.Zero);
        }
        else
        {
            return(DynamicViscosity.FromPascalSeconds(localVis));
        }
    }
Beispiel #4
0
 /// <inheritdoc cref="DynamicViscosity.FromPascalSeconds(double?)"/>
 public static DynamicViscosity?PascalSeconds(this decimal?value) => DynamicViscosity.FromPascalSeconds(value == null ? (double?)null : Convert.ToDouble(value.Value));
Beispiel #5
0
 /// <inheritdoc cref="DynamicViscosity.FromPascalSeconds(double)"/>
 public static DynamicViscosity PascalSeconds(this decimal value) => DynamicViscosity.FromPascalSeconds(Convert.ToDouble(value));
Beispiel #6
0
 /// <inheritdoc cref="DynamicViscosity.FromPascalSeconds(double?)"/>
 public static DynamicViscosity?PascalSeconds(this float?value) => DynamicViscosity.FromPascalSeconds(value);
Beispiel #7
0
 /// <inheritdoc cref="DynamicViscosity.FromPascalSeconds(double)"/>
 public static DynamicViscosity PascalSeconds(this double value) => DynamicViscosity.FromPascalSeconds(value);
Beispiel #8
0
 public static DynamicViscosity PascalSeconds <T>(this T value) =>
 DynamicViscosity.FromPascalSeconds(Convert.ToDecimal(value));
 public static DynamicViscosity?PascalSeconds <T>(this T?value) where T : struct => DynamicViscosity.FromPascalSeconds(value == null ? (double?)null : Convert.ToDouble(value.Value));
 public void NumberToPascalSecondsTest() =>
 Assert.Equal(DynamicViscosity.FromPascalSeconds(2), 2.PascalSeconds());