public void EqualsRelativeToleranceIsImplemented() { var v = TorquePerLength.FromNewtonMetersPerMeter(1); Assert.True(v.Equals(TorquePerLength.FromNewtonMetersPerMeter(1), NewtonMetersPerMeterTolerance, ComparisonType.Relative)); Assert.False(v.Equals(TorquePerLength.Zero, NewtonMetersPerMeterTolerance, ComparisonType.Relative)); }
public void ConversionRoundTrip() { TorquePerLength newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); AssertEx.EqualTolerance(1, TorquePerLength.FromKilogramForceCentimetersPerMeter(newtonmeterpermeter.KilogramForceCentimetersPerMeter).NewtonMetersPerMeter, KilogramForceCentimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromKilogramForceMetersPerMeter(newtonmeterpermeter.KilogramForceMetersPerMeter).NewtonMetersPerMeter, KilogramForceMetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromKilogramForceMillimetersPerMeter(newtonmeterpermeter.KilogramForceMillimetersPerMeter).NewtonMetersPerMeter, KilogramForceMillimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromKilonewtonCentimetersPerMeter(newtonmeterpermeter.KilonewtonCentimetersPerMeter).NewtonMetersPerMeter, KilonewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromKilonewtonMetersPerMeter(newtonmeterpermeter.KilonewtonMetersPerMeter).NewtonMetersPerMeter, KilonewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromKilonewtonMillimetersPerMeter(newtonmeterpermeter.KilonewtonMillimetersPerMeter).NewtonMetersPerMeter, KilonewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromKilopoundForceFeetPerFoot(newtonmeterpermeter.KilopoundForceFeetPerFoot).NewtonMetersPerMeter, KilopoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromKilopoundForceInchesPerFoot(newtonmeterpermeter.KilopoundForceInchesPerFoot).NewtonMetersPerMeter, KilopoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromMeganewtonCentimetersPerMeter(newtonmeterpermeter.MeganewtonCentimetersPerMeter).NewtonMetersPerMeter, MeganewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromMeganewtonMetersPerMeter(newtonmeterpermeter.MeganewtonMetersPerMeter).NewtonMetersPerMeter, MeganewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromMeganewtonMillimetersPerMeter(newtonmeterpermeter.MeganewtonMillimetersPerMeter).NewtonMetersPerMeter, MeganewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromMegapoundForceFeetPerFoot(newtonmeterpermeter.MegapoundForceFeetPerFoot).NewtonMetersPerMeter, MegapoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromMegapoundForceInchesPerFoot(newtonmeterpermeter.MegapoundForceInchesPerFoot).NewtonMetersPerMeter, MegapoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromNewtonCentimetersPerMeter(newtonmeterpermeter.NewtonCentimetersPerMeter).NewtonMetersPerMeter, NewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromNewtonMetersPerMeter(newtonmeterpermeter.NewtonMetersPerMeter).NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromNewtonMillimetersPerMeter(newtonmeterpermeter.NewtonMillimetersPerMeter).NewtonMetersPerMeter, NewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromPoundForceFeetPerFoot(newtonmeterpermeter.PoundForceFeetPerFoot).NewtonMetersPerMeter, PoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromPoundForceInchesPerFoot(newtonmeterpermeter.PoundForceInchesPerFoot).NewtonMetersPerMeter, PoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromTonneForceCentimetersPerMeter(newtonmeterpermeter.TonneForceCentimetersPerMeter).NewtonMetersPerMeter, TonneForceCentimetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromTonneForceMetersPerMeter(newtonmeterpermeter.TonneForceMetersPerMeter).NewtonMetersPerMeter, TonneForceMetersPerMeterTolerance); AssertEx.EqualTolerance(1, TorquePerLength.FromTonneForceMillimetersPerMeter(newtonmeterpermeter.TonneForceMillimetersPerMeter).NewtonMetersPerMeter, TonneForceMillimetersPerMeterTolerance); }
public void As() { var newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); AssertEx.EqualTolerance(KilogramForceCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilogramForceCentimeterPerMeter), KilogramForceCentimetersPerMeterTolerance); AssertEx.EqualTolerance(KilogramForceMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilogramForceMeterPerMeter), KilogramForceMetersPerMeterTolerance); AssertEx.EqualTolerance(KilogramForceMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilogramForceMillimeterPerMeter), KilogramForceMillimetersPerMeterTolerance); AssertEx.EqualTolerance(KilonewtonCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilonewtonCentimeterPerMeter), KilonewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(KilonewtonMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilonewtonMeterPerMeter), KilonewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(KilonewtonMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilonewtonMillimeterPerMeter), KilonewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(KilopoundForceFeetPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilopoundForceFootPerFoot), KilopoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(KilopoundForceInchesPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.KilopoundForceInchPerFoot), KilopoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(MeganewtonCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.MeganewtonCentimeterPerMeter), MeganewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(MeganewtonMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.MeganewtonMeterPerMeter), MeganewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(MeganewtonMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.MeganewtonMillimeterPerMeter), MeganewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(MegapoundForceFeetPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.MegapoundForceFootPerFoot), MegapoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(MegapoundForceInchesPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.MegapoundForceInchPerFoot), MegapoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(NewtonCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.NewtonCentimeterPerMeter), NewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(NewtonMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.NewtonMeterPerMeter), NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(NewtonMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.NewtonMillimeterPerMeter), NewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(PoundForceFeetPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.PoundForceFootPerFoot), PoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(PoundForceInchesPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.PoundForceInchPerFoot), PoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(TonneForceCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.TonneForceCentimeterPerMeter), TonneForceCentimetersPerMeterTolerance); AssertEx.EqualTolerance(TonneForceMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.TonneForceMeterPerMeter), TonneForceMetersPerMeterTolerance); AssertEx.EqualTolerance(TonneForceMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.As(TorquePerLengthUnit.TonneForceMillimeterPerMeter), TonneForceMillimetersPerMeterTolerance); }
public void NewtonMeterPerMeterToTorquePerLengthUnits() { TorquePerLength newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); AssertEx.EqualTolerance(KilogramForceCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.KilogramForceCentimetersPerMeter, KilogramForceCentimetersPerMeterTolerance); AssertEx.EqualTolerance(KilogramForceMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.KilogramForceMetersPerMeter, KilogramForceMetersPerMeterTolerance); AssertEx.EqualTolerance(KilogramForceMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.KilogramForceMillimetersPerMeter, KilogramForceMillimetersPerMeterTolerance); AssertEx.EqualTolerance(KilonewtonCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.KilonewtonCentimetersPerMeter, KilonewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(KilonewtonMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.KilonewtonMetersPerMeter, KilonewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(KilonewtonMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.KilonewtonMillimetersPerMeter, KilonewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(KilopoundForceFeetPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.KilopoundForceFeetPerFoot, KilopoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(KilopoundForceInchesPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.KilopoundForceInchesPerFoot, KilopoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(MeganewtonCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.MeganewtonCentimetersPerMeter, MeganewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(MeganewtonMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.MeganewtonMetersPerMeter, MeganewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(MeganewtonMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.MeganewtonMillimetersPerMeter, MeganewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(MegapoundForceFeetPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.MegapoundForceFeetPerFoot, MegapoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(MegapoundForceInchesPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.MegapoundForceInchesPerFoot, MegapoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(NewtonCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.NewtonCentimetersPerMeter, NewtonCentimetersPerMeterTolerance); AssertEx.EqualTolerance(NewtonMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(NewtonMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.NewtonMillimetersPerMeter, NewtonMillimetersPerMeterTolerance); AssertEx.EqualTolerance(PoundForceFeetPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.PoundForceFeetPerFoot, PoundForceFeetPerFootTolerance); AssertEx.EqualTolerance(PoundForceInchesPerFootInOneNewtonMeterPerMeter, newtonmeterpermeter.PoundForceInchesPerFoot, PoundForceInchesPerFootTolerance); AssertEx.EqualTolerance(TonneForceCentimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.TonneForceCentimetersPerMeter, TonneForceCentimetersPerMeterTolerance); AssertEx.EqualTolerance(TonneForceMetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.TonneForceMetersPerMeter, TonneForceMetersPerMeterTolerance); AssertEx.EqualTolerance(TonneForceMillimetersPerMeterInOneNewtonMeterPerMeter, newtonmeterpermeter.TonneForceMillimetersPerMeter, TonneForceMillimetersPerMeterTolerance); }
public void CompareToIsImplemented() { TorquePerLength newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); Assert.Equal(0, newtonmeterpermeter.CompareTo(newtonmeterpermeter)); Assert.True(newtonmeterpermeter.CompareTo(TorquePerLength.Zero) > 0); Assert.True(TorquePerLength.Zero.CompareTo(newtonmeterpermeter) < 0); }
public void EqualsIsImplemented() { var a = TorquePerLength.FromNewtonMetersPerMeter(1); var b = TorquePerLength.FromNewtonMetersPerMeter(2); Assert.True(a.Equals(a)); Assert.False(a.Equals(b)); Assert.False(a.Equals(null)); }
public void ArithmeticOperators() { TorquePerLength v = TorquePerLength.FromNewtonMetersPerMeter(1); AssertEx.EqualTolerance(-1, -v.NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(2, (TorquePerLength.FromNewtonMetersPerMeter(3) - v).NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(2, (v + v).NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(10, (v * 10).NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(10, (10 * v).NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(2, (TorquePerLength.FromNewtonMetersPerMeter(10) / 5).NewtonMetersPerMeter, NewtonMetersPerMeterTolerance); AssertEx.EqualTolerance(2, TorquePerLength.FromNewtonMetersPerMeter(10) / TorquePerLength.FromNewtonMetersPerMeter(5), NewtonMetersPerMeterTolerance); }
public void ComparisonOperators() { TorquePerLength oneNewtonMeterPerMeter = TorquePerLength.FromNewtonMetersPerMeter(1); TorquePerLength twoNewtonMetersPerMeter = TorquePerLength.FromNewtonMetersPerMeter(2); Assert.True(oneNewtonMeterPerMeter < twoNewtonMetersPerMeter); Assert.True(oneNewtonMeterPerMeter <= twoNewtonMetersPerMeter); Assert.True(twoNewtonMetersPerMeter > oneNewtonMeterPerMeter); Assert.True(twoNewtonMetersPerMeter >= oneNewtonMeterPerMeter); Assert.False(oneNewtonMeterPerMeter > twoNewtonMetersPerMeter); Assert.False(oneNewtonMeterPerMeter >= twoNewtonMetersPerMeter); Assert.False(twoNewtonMetersPerMeter < oneNewtonMeterPerMeter); Assert.False(twoNewtonMetersPerMeter <= oneNewtonMeterPerMeter); }
public void EqualityOperators() { var a = TorquePerLength.FromNewtonMetersPerMeter(1); var b = TorquePerLength.FromNewtonMetersPerMeter(2); // ReSharper disable EqualExpressionComparison Assert.True(a == a); Assert.False(a != a); Assert.True(a != b); Assert.False(a == b); Assert.False(a == null); Assert.False(null == a); // ReSharper restore EqualExpressionComparison }
public void EqualsReturnsFalseOnNull() { TorquePerLength newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); Assert.False(newtonmeterpermeter.Equals(null)); }
public void EqualsReturnsFalseOnTypeMismatch() { TorquePerLength newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); Assert.False(newtonmeterpermeter.Equals(new object())); }
public void CompareToThrowsOnNull() { TorquePerLength newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); Assert.Throws <ArgumentNullException>(() => newtonmeterpermeter.CompareTo(null)); }
public void FromNewtonMetersPerMeter_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => TorquePerLength.FromNewtonMetersPerMeter(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => TorquePerLength.FromNewtonMetersPerMeter(double.NegativeInfinity)); }
public void ToUnit() { var newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); var kilogramforcecentimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilogramForceCentimeterPerMeter); AssertEx.EqualTolerance(KilogramForceCentimetersPerMeterInOneNewtonMeterPerMeter, (double)kilogramforcecentimeterpermeterQuantity.Value, KilogramForceCentimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.KilogramForceCentimeterPerMeter, kilogramforcecentimeterpermeterQuantity.Unit); var kilogramforcemeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilogramForceMeterPerMeter); AssertEx.EqualTolerance(KilogramForceMetersPerMeterInOneNewtonMeterPerMeter, (double)kilogramforcemeterpermeterQuantity.Value, KilogramForceMetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.KilogramForceMeterPerMeter, kilogramforcemeterpermeterQuantity.Unit); var kilogramforcemillimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilogramForceMillimeterPerMeter); AssertEx.EqualTolerance(KilogramForceMillimetersPerMeterInOneNewtonMeterPerMeter, (double)kilogramforcemillimeterpermeterQuantity.Value, KilogramForceMillimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.KilogramForceMillimeterPerMeter, kilogramforcemillimeterpermeterQuantity.Unit); var kilonewtoncentimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilonewtonCentimeterPerMeter); AssertEx.EqualTolerance(KilonewtonCentimetersPerMeterInOneNewtonMeterPerMeter, (double)kilonewtoncentimeterpermeterQuantity.Value, KilonewtonCentimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.KilonewtonCentimeterPerMeter, kilonewtoncentimeterpermeterQuantity.Unit); var kilonewtonmeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilonewtonMeterPerMeter); AssertEx.EqualTolerance(KilonewtonMetersPerMeterInOneNewtonMeterPerMeter, (double)kilonewtonmeterpermeterQuantity.Value, KilonewtonMetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.KilonewtonMeterPerMeter, kilonewtonmeterpermeterQuantity.Unit); var kilonewtonmillimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilonewtonMillimeterPerMeter); AssertEx.EqualTolerance(KilonewtonMillimetersPerMeterInOneNewtonMeterPerMeter, (double)kilonewtonmillimeterpermeterQuantity.Value, KilonewtonMillimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.KilonewtonMillimeterPerMeter, kilonewtonmillimeterpermeterQuantity.Unit); var kilopoundforcefootperfootQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilopoundForceFootPerFoot); AssertEx.EqualTolerance(KilopoundForceFeetPerFootInOneNewtonMeterPerMeter, (double)kilopoundforcefootperfootQuantity.Value, KilopoundForceFeetPerFootTolerance); Assert.Equal(TorquePerLengthUnit.KilopoundForceFootPerFoot, kilopoundforcefootperfootQuantity.Unit); var kilopoundforceinchperfootQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.KilopoundForceInchPerFoot); AssertEx.EqualTolerance(KilopoundForceInchesPerFootInOneNewtonMeterPerMeter, (double)kilopoundforceinchperfootQuantity.Value, KilopoundForceInchesPerFootTolerance); Assert.Equal(TorquePerLengthUnit.KilopoundForceInchPerFoot, kilopoundforceinchperfootQuantity.Unit); var meganewtoncentimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.MeganewtonCentimeterPerMeter); AssertEx.EqualTolerance(MeganewtonCentimetersPerMeterInOneNewtonMeterPerMeter, (double)meganewtoncentimeterpermeterQuantity.Value, MeganewtonCentimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.MeganewtonCentimeterPerMeter, meganewtoncentimeterpermeterQuantity.Unit); var meganewtonmeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.MeganewtonMeterPerMeter); AssertEx.EqualTolerance(MeganewtonMetersPerMeterInOneNewtonMeterPerMeter, (double)meganewtonmeterpermeterQuantity.Value, MeganewtonMetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.MeganewtonMeterPerMeter, meganewtonmeterpermeterQuantity.Unit); var meganewtonmillimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.MeganewtonMillimeterPerMeter); AssertEx.EqualTolerance(MeganewtonMillimetersPerMeterInOneNewtonMeterPerMeter, (double)meganewtonmillimeterpermeterQuantity.Value, MeganewtonMillimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.MeganewtonMillimeterPerMeter, meganewtonmillimeterpermeterQuantity.Unit); var megapoundforcefootperfootQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.MegapoundForceFootPerFoot); AssertEx.EqualTolerance(MegapoundForceFeetPerFootInOneNewtonMeterPerMeter, (double)megapoundforcefootperfootQuantity.Value, MegapoundForceFeetPerFootTolerance); Assert.Equal(TorquePerLengthUnit.MegapoundForceFootPerFoot, megapoundforcefootperfootQuantity.Unit); var megapoundforceinchperfootQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.MegapoundForceInchPerFoot); AssertEx.EqualTolerance(MegapoundForceInchesPerFootInOneNewtonMeterPerMeter, (double)megapoundforceinchperfootQuantity.Value, MegapoundForceInchesPerFootTolerance); Assert.Equal(TorquePerLengthUnit.MegapoundForceInchPerFoot, megapoundforceinchperfootQuantity.Unit); var newtoncentimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.NewtonCentimeterPerMeter); AssertEx.EqualTolerance(NewtonCentimetersPerMeterInOneNewtonMeterPerMeter, (double)newtoncentimeterpermeterQuantity.Value, NewtonCentimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.NewtonCentimeterPerMeter, newtoncentimeterpermeterQuantity.Unit); var newtonmeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.NewtonMeterPerMeter); AssertEx.EqualTolerance(NewtonMetersPerMeterInOneNewtonMeterPerMeter, (double)newtonmeterpermeterQuantity.Value, NewtonMetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.NewtonMeterPerMeter, newtonmeterpermeterQuantity.Unit); var newtonmillimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.NewtonMillimeterPerMeter); AssertEx.EqualTolerance(NewtonMillimetersPerMeterInOneNewtonMeterPerMeter, (double)newtonmillimeterpermeterQuantity.Value, NewtonMillimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.NewtonMillimeterPerMeter, newtonmillimeterpermeterQuantity.Unit); var poundforcefootperfootQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.PoundForceFootPerFoot); AssertEx.EqualTolerance(PoundForceFeetPerFootInOneNewtonMeterPerMeter, (double)poundforcefootperfootQuantity.Value, PoundForceFeetPerFootTolerance); Assert.Equal(TorquePerLengthUnit.PoundForceFootPerFoot, poundforcefootperfootQuantity.Unit); var poundforceinchperfootQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.PoundForceInchPerFoot); AssertEx.EqualTolerance(PoundForceInchesPerFootInOneNewtonMeterPerMeter, (double)poundforceinchperfootQuantity.Value, PoundForceInchesPerFootTolerance); Assert.Equal(TorquePerLengthUnit.PoundForceInchPerFoot, poundforceinchperfootQuantity.Unit); var tonneforcecentimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.TonneForceCentimeterPerMeter); AssertEx.EqualTolerance(TonneForceCentimetersPerMeterInOneNewtonMeterPerMeter, (double)tonneforcecentimeterpermeterQuantity.Value, TonneForceCentimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.TonneForceCentimeterPerMeter, tonneforcecentimeterpermeterQuantity.Unit); var tonneforcemeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.TonneForceMeterPerMeter); AssertEx.EqualTolerance(TonneForceMetersPerMeterInOneNewtonMeterPerMeter, (double)tonneforcemeterpermeterQuantity.Value, TonneForceMetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.TonneForceMeterPerMeter, tonneforcemeterpermeterQuantity.Unit); var tonneforcemillimeterpermeterQuantity = newtonmeterpermeter.ToUnit(TorquePerLengthUnit.TonneForceMillimeterPerMeter); AssertEx.EqualTolerance(TonneForceMillimetersPerMeterInOneNewtonMeterPerMeter, (double)tonneforcemillimeterpermeterQuantity.Value, TonneForceMillimetersPerMeterTolerance); Assert.Equal(TorquePerLengthUnit.TonneForceMillimeterPerMeter, tonneforcemillimeterpermeterQuantity.Unit); }
public void FromNewtonMetersPerMeter_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => TorquePerLength.FromNewtonMetersPerMeter(double.NaN)); }
public void NumberToNewtonMetersPerMeterTest() => Assert.Equal(TorquePerLength.FromNewtonMetersPerMeter(2), 2.NewtonMetersPerMeter());
public static TorquePerLength NewtonMetersPerMeter <T>(this T value) => TorquePerLength.FromNewtonMetersPerMeter(Convert.ToDouble(value));
public void CompareToThrowsOnTypeMismatch() { TorquePerLength newtonmeterpermeter = TorquePerLength.FromNewtonMetersPerMeter(1); Assert.Throws <ArgumentException>(() => newtonmeterpermeter.CompareTo(new object())); }