コード例 #1
0
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
コード例 #2
0
        public void Convert_ToDouble_EqualsValueAsSameType()
        {
            var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0);

            Assert.Equal((double)quantity.Value, Convert.ToDouble(quantity));
        }
コード例 #3
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
コード例 #4
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
コード例 #5
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1);

            Assert.False(cubicmeterpersecondpersquaremeter.Equals(new object()));
        }
コード例 #6
0
        public void EqualsReturnsFalseOnNull()
        {
            VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1);

            Assert.False(cubicmeterpersecondpersquaremeter.Equals(null));
        }
コード例 #7
0
        public void CompareToThrowsOnNull()
        {
            VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1);

            Assert.Throws <ArgumentNullException>(() => cubicmeterpersecondpersquaremeter.CompareTo(null));
        }
コード例 #8
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1), -1, ComparisonType.Relative));
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        public void CompareToThrowsOnTypeMismatch()
        {
            VolumeFlowPerArea cubicmeterpersecondpersquaremeter = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1);

            Assert.Throws <ArgumentException>(() => cubicmeterpersecondpersquaremeter.CompareTo(new object()));
        }
コード例 #11
0
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(1).ToBaseUnit();

            Assert.Equal(VolumeFlowPerArea.BaseUnit, quantityInBaseUnit.Unit);
        }
コード例 #12
0
 public void FromCubicMetersPerSecondPerSquareMeter_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NaN));
 }
コード例 #13
0
 public void FromCubicMetersPerSecondPerSquareMeter_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(double.NegativeInfinity));
 }
コード例 #14
0
 public static VolumeFlowPerArea CubicMetersPerSecondPerSquareMeter <T>(this T value) =>
 VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(Convert.ToDouble(value));
コード例 #15
0
 public void NumberToCubicMetersPerSecondPerSquareMeterTest() =>
 Assert.Equal(VolumeFlowPerArea.FromCubicMetersPerSecondPerSquareMeter(2), 2.CubicMetersPerSecondPerSquareMeter());