Beispiel #1
0
 public static VolumePerLength OilBarrelsPerFoot <T>(this T value) =>
 VolumePerLength.FromOilBarrelsPerFoot(Convert.ToDecimal(value));
 public void NumberToCubicYardsPerUsSurveyFootTest() =>
 Assert.Equal(VolumePerLength.FromCubicYardsPerUsSurveyFoot(2), 2.CubicYardsPerUsSurveyFoot());
 public void NumberToOilBarrelsPerFootTest() =>
 Assert.Equal(VolumePerLength.FromOilBarrelsPerFoot(2), 2.OilBarrelsPerFoot());
Beispiel #4
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1);

            Assert.False(cubicmeterpermeter.Equals(new object()));
        }
Beispiel #5
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.CubicMeterPerMeter).CubicMetersPerMeter, CubicMetersPerMeterTolerance);
     AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.LiterPerMeter).LitersPerMeter, LitersPerMeterTolerance);
     AssertEx.EqualTolerance(1, VolumePerLength.From(1, VolumePerLengthUnit.OilBarrelPerFoot).OilBarrelsPerFoot, OilBarrelsPerFootTolerance);
 }
Beispiel #6
0
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(decimal value)
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(value);

            Assert.Equal(VolumePerLength.FromCubicMetersPerMeter(-value), -quantity);
        }
Beispiel #7
0
        public void CompareToThrowsOnTypeMismatch()
        {
            VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1);

            Assert.Throws <ArgumentException>(() => cubicmeterpermeter.CompareTo(new object()));
        }
Beispiel #8
0
        public void Convert_ToDecimal_EqualsValueAsSameType()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity));
        }
Beispiel #9
0
        public void Convert_ToInt16_EqualsValueAsSameType()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity));
        }
Beispiel #10
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
Beispiel #11
0
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
Beispiel #12
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
Beispiel #13
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = VolumePerLength.FromCubicMetersPerMeter(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(VolumePerLength.FromCubicMetersPerMeter(1), -1, ComparisonType.Relative));
        }
Beispiel #14
0
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = VolumePerLength.FromCubicMetersPerMeter(1).ToBaseUnit();

            Assert.Equal(VolumePerLength.BaseUnit, quantityInBaseUnit.Unit);
        }
Beispiel #15
0
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
Beispiel #16
0
        public void Convert_ToSingle_EqualsValueAsSameType()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity));
        }
Beispiel #17
0
        public void GetHashCode_Equals()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal(new { VolumePerLength.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
Beispiel #18
0
        public void Convert_ToString_EqualsToString()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
Beispiel #19
0
 public void FromCubicMetersPerMeter_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => VolumePerLength.FromCubicMetersPerMeter(double.NaN));
 }
Beispiel #20
0
        public void Convert_ToUInt64_EqualsValueAsSameType()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity));
        }
Beispiel #21
0
        public void CompareToThrowsOnNull()
        {
            VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1);

            Assert.Throws <ArgumentNullException>(() => cubicmeterpermeter.CompareTo(null));
        }
Beispiel #22
0
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(VolumePerLength)));
        }
Beispiel #23
0
        public void EqualsReturnsFalseOnNull()
        {
            VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1);

            Assert.False(cubicmeterpermeter.Equals(null));
        }
Beispiel #24
0
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(VolumePerLengthUnit)));
        }
 public void NumberToCubicMetersPerMeterTest() =>
 Assert.Equal(VolumePerLength.FromCubicMetersPerMeter(2), 2.CubicMetersPerMeter());
Beispiel #26
0
        public void Convert_ChangeType_QuantityType_EqualsQuantityType()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal(QuantityType.VolumePerLength, Convert.ChangeType(quantity, typeof(QuantityType)));
        }
 public void NumberToLitersPerMillimeterTest() =>
 Assert.Equal(VolumePerLength.FromLitersPerMillimeter(2), 2.LitersPerMillimeter());
Beispiel #28
0
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

            Assert.Equal(VolumePerLength.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
 public void FromCubicMetersPerMeter_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => VolumePerLength.FromCubicMetersPerMeter(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => VolumePerLength.FromCubicMetersPerMeter(double.NegativeInfinity));
 }
Beispiel #30
0
 public static VolumePerLength LitersPerMillimeter <T>(this T value) =>
 VolumePerLength.FromLitersPerMillimeter(Convert.ToDecimal(value));