Пример #1
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1);

            Assert.False(pascalpersecond.Equals(new object()));
        }
 /// <inheritdoc cref="PressureChangeRate.FromAtmospheresPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate AtmospheresPerSecond(this decimal value) => PressureChangeRate.FromAtmospheresPerSecond(Convert.ToDouble(value));
 /// <inheritdoc cref="PressureChangeRate.FromKilopascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate?KilopascalsPerSecond(this long?value) => PressureChangeRate.FromKilopascalsPerSecond(value);
 /// <inheritdoc cref="PressureChangeRate.FromPascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate?PascalsPerSecond(this float?value) => PressureChangeRate.FromPascalsPerSecond(value);
 /// <inheritdoc cref="PressureChangeRate.FromAtmospheresPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate AtmospheresPerSecond(this double value) => PressureChangeRate.FromAtmospheresPerSecond(value);
 /// <inheritdoc cref="PressureChangeRate.FromMegapascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate?MegapascalsPerSecond(this double?value) => PressureChangeRate.FromMegapascalsPerSecond(value);
 /// <inheritdoc cref="PressureChangeRate.FromMegapascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate?MegapascalsPerSecond(this decimal?value) => PressureChangeRate.FromMegapascalsPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value));
Пример #8
0
        public void Convert_ToInt16_EqualsValueAsSameType()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity));
        }
Пример #9
0
        public void Convert_ToSingle_EqualsValueAsSameType()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity));
        }
Пример #10
0
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
Пример #11
0
        public void Convert_ToDecimal_EqualsValueAsSameType()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity));
        }
Пример #12
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
Пример #13
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
Пример #14
0
        public void EqualsReturnsFalseOnNull()
        {
            PressureChangeRate pascalpersecond = PressureChangeRate.FromPascalsPerSecond(1);

            Assert.False(pascalpersecond.Equals(null));
        }
Пример #15
0
        public void GetHashCode_Equals()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal(new { PressureChangeRate.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
Пример #16
0
        public void Convert_ToString_EqualsToString()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
Пример #17
0
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value)
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(value);

            Assert.Equal(PressureChangeRate.FromPascalsPerSecond(-value), -quantity);
        }
Пример #18
0
        public void Convert_ToUInt64_EqualsValueAsSameType()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity));
        }
 /// <inheritdoc cref="PressureChangeRate.FromMegapascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate MegapascalsPerSecond(this float value) => PressureChangeRate.FromMegapascalsPerSecond(value);
Пример #20
0
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(PressureChangeRate)));
        }
 /// <inheritdoc cref="PressureChangeRate.FromPascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate PascalsPerSecond(this long value) => PressureChangeRate.FromPascalsPerSecond(value);
Пример #22
0
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(PressureChangeRateUnit)));
        }
 /// <inheritdoc cref="PressureChangeRate.FromPascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate PascalsPerSecond(this decimal value) => PressureChangeRate.FromPascalsPerSecond(Convert.ToDouble(value));
Пример #24
0
        public void Convert_ChangeType_QuantityType_EqualsQuantityType()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal(QuantityType.PressureChangeRate, Convert.ChangeType(quantity, typeof(QuantityType)));
        }
 /// <inheritdoc cref="PressureChangeRate.FromAtmospheresPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate?AtmospheresPerSecond(this float?value) => PressureChangeRate.FromAtmospheresPerSecond(value);
Пример #26
0
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Equal(PressureChangeRate.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
 /// <inheritdoc cref="PressureChangeRate.FromAtmospheresPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate?AtmospheresPerSecond(this decimal?value) => PressureChangeRate.FromAtmospheresPerSecond(value == null ? (double?)null : Convert.ToDouble(value.Value));
Пример #28
0
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = PressureChangeRate.FromPascalsPerSecond(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
 /// <inheritdoc cref="PressureChangeRate.FromKilopascalsPerSecond(UnitsNet.QuantityValue)" />
 public static PressureChangeRate KilopascalsPerSecond(this double value) => PressureChangeRate.FromKilopascalsPerSecond(value);
Пример #30
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = PressureChangeRate.FromPascalsPerSecond(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(PressureChangeRate.FromPascalsPerSecond(1), -1, ComparisonType.Relative));
        }