public void Convert_ToSingle_EqualsValueAsSameType() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity)); }
public void Convert_ToString_EqualsToString() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Equal(quantity.ToString(), Convert.ToString(quantity)); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void FromKilogramsPerJoule_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NegativeInfinity)); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1), -1, ComparisonType.Relative)); }
public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Equal(BrakeSpecificFuelConsumption.Info, Convert.ChangeType(quantity, typeof(QuantityInfo))); }
public void CompareToThrowsOnTypeMismatch() { BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.Throws <ArgumentException>(() => kilogramperjoule.CompareTo(new object())); }
public void CompareToThrowsOnNull() { BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.Throws <ArgumentNullException>(() => kilogramperjoule.CompareTo(null)); }
public void ArithmeticOperators() { BrakeSpecificFuelConsumption v = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); AssertEx.EqualTolerance(-1, -v.KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(3) - v).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(2, (v + v).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(10, (v * 10).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(10, (10 * v).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(2, (BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10) / 5).KilogramsPerJoule, KilogramsPerJouleTolerance); AssertEx.EqualTolerance(2, BrakeSpecificFuelConsumption.FromKilogramsPerJoule(10) / BrakeSpecificFuelConsumption.FromKilogramsPerJoule(5), KilogramsPerJouleTolerance); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1).ToBaseUnit(); Assert.Equal(BrakeSpecificFuelConsumption.BaseUnit, quantityInBaseUnit.Unit); }
public void FromKilogramsPerJoule_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => BrakeSpecificFuelConsumption.FromKilogramsPerJoule(double.NaN)); }
public void Convert_ToUInt64_EqualsValueAsSameType() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity)); }
public void EqualsReturnsFalseOnTypeMismatch() { BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.False(kilogramperjoule.Equals(new object())); }
public void Convert_ChangeType_UnitType_EqualsUnit() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(BrakeSpecificFuelConsumptionUnit))); }
public void EqualsReturnsFalseOnNull() { BrakeSpecificFuelConsumption kilogramperjoule = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1); Assert.False(kilogramperjoule.Equals(null)); }
public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions() { var quantity = BrakeSpecificFuelConsumption.FromKilogramsPerJoule(1.0); Assert.Equal(BrakeSpecificFuelConsumption.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions))); }
public void PowerTimesBrakeSpecificFuelConsumptionEqualsMassFlow() { MassFlow massFlow = Power.FromKilowatts(20.0 / 24.0 * 1e6 / 180.0) * BrakeSpecificFuelConsumption.FromGramsPerKiloWattHour(180.0); AssertEx.EqualTolerance(massFlow.TonnesPerDay, 20.0, 1e-11); }