Exemplo n.º 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());
Exemplo n.º 4
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            VolumePerLength cubicmeterpermeter = VolumePerLength.FromCubicMetersPerMeter(1);

            Assert.False(cubicmeterpermeter.Equals(new object()));
        }
Exemplo n.º 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);
 }
Exemplo n.º 6
0
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(decimal value)
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(value);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Assert.False(cubicmeterpermeter.Equals(null));
        }
Exemplo n.º 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());
Exemplo n.º 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());
Exemplo n.º 28
0
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = VolumePerLength.FromCubicMetersPerMeter(1.0);

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