public void Convert_ToDateTime_ThrowsInvalidCastException() { var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0); Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity)); }
public void Convert_ToDouble_EqualsValueAsSameType() { var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0); Assert.Equal((double)quantity.Value, Convert.ToDouble(quantity)); }
public void ToString_NullArgs_ThrowsArgumentNullException() { var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0); Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null)); }
public void ToString_NullProvider_EqualsCurrentUICulture() { var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0); Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g")); }
public void EqualsReturnsFalseOnTypeMismatch() { VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1); Assert.False(cubicmeterpersecondpersquaremeter.Equals(new object())); }
public void EqualsReturnsFalseOnNull() { VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1); Assert.False(cubicmeterpersecondpersquaremeter.Equals(null)); }
public void CompareToThrowsOnNull() { VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1); Assert.Throws <ArgumentNullException>(() => cubicmeterpersecondpersquaremeter.CompareTo(null)); }
public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException() { var v = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1); Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1), -1, ComparisonType.Relative)); }
public void ArithmeticOperators() { VolumeFlowPerArea v = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1); AssertEx.EqualTolerance(-1, -v.CubicMetersPerSecondPerSquareMeter, CubicMetersPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(3) - v).CubicMetersPerSecondPerSquareMeter, CubicMetersPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (v + v).CubicMetersPerSecondPerSquareMeter, CubicMetersPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (v * 10).CubicMetersPerSecondPerSquareMeter, CubicMetersPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(10, (10 * v).CubicMetersPerSecondPerSquareMeter, CubicMetersPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(2, (VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(10) / 5).CubicMetersPerSecondPerSquareMeter, CubicMetersPerSecondPerSquareMeterTolerance); AssertEx.EqualTolerance(2, VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(10) / VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(5), CubicMetersPerSecondPerSquareMeterTolerance); }
public void CompareToThrowsOnTypeMismatch() { VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1); Assert.Throws <ArgumentException>(() => cubicmeterpersecondpersquaremeter.CompareTo(new object())); }
public void ToBaseUnit_ReturnsQuantityWithBaseUnit() { var quantityInBaseUnit = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1).ToBaseUnit(); Assert.Equal(VolumeFlowPerArea.BaseUnit, quantityInBaseUnit.Unit); }
public void FromCubicMetersPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NaN)); }
public void FromCubicMetersPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException() { Assert.Throws <ArgumentException>(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.PositiveInfinity)); Assert.Throws <ArgumentException>(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NegativeInfinity)); }
public static VolumeFlowPerArea CubicMetersPerSecondPerSquareMeter <T>(this T value) => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(Convert.ToDouble(value));
public void NumberToCubicMetersPerSecondPerSquareMeterTest() => Assert.Equal(VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(2), 2.CubicMetersPerSecondPerSquareMeter());