Esempio n. 1
0
        public void Convert_ToInt32_EqualsValueAsSameType()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity));
        }
Esempio n. 2
0
 /// <inheritdoc cref="ReactivePower.FromVoltamperesReactive(UnitsNet.QuantityValue)" />
 public static ReactivePower VoltamperesReactive <T>(this T value) => ReactivePower.FromVoltamperesReactive(Convert.ToDouble(value));
 /// <inheritdoc cref="ReactivePower.FromVoltamperesReactive(UnitsNet.QuantityValue)" />
 public static ReactivePower?VoltamperesReactive(this float?value) => ReactivePower.FromVoltamperesReactive(value);
Esempio n. 4
0
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal(ReactivePower.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
Esempio n. 5
0
        public void GetHashCode_Equals()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal(new { ReactivePower.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
Esempio n. 6
0
        public void Convert_ToUInt64_EqualsValueAsSameType()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity));
        }
Esempio n. 7
0
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(ReactivePowerUnit)));
        }
Esempio n. 8
0
        public void CompareToThrowsOnNull()
        {
            ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1);

            Assert.Throws <ArgumentNullException>(() => voltamperereactive.CompareTo(null));
        }
Esempio n. 9
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = ReactivePower.FromVoltamperesReactive(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(ReactivePower.FromVoltamperesReactive(1), -1, ComparisonType.Relative));
        }
Esempio n. 10
0
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = ReactivePower.FromVoltamperesReactive(1).ToBaseUnit();

            Assert.Equal(ReactivePower.BaseUnit, quantityInBaseUnit.Unit);
        }
Esempio n. 11
0
        public void CompareToThrowsOnTypeMismatch()
        {
            ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1);

            Assert.Throws <ArgumentException>(() => voltamperereactive.CompareTo(new object()));
        }
Esempio n. 12
0
 public void FromVoltamperesReactive_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ReactivePower.FromVoltamperesReactive(double.NaN));
 }
Esempio n. 13
0
 public void FromVoltamperesReactive_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ReactivePower.FromVoltamperesReactive(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => ReactivePower.FromVoltamperesReactive(double.NegativeInfinity));
 }
 /// <inheritdoc cref="ReactivePower.FromVoltamperesReactive(UnitsNet.QuantityValue)" />
 public static ReactivePower?VoltamperesReactive(this decimal?value) => ReactivePower.FromVoltamperesReactive(value == null ? (double?)null : Convert.ToDouble(value.Value));
Esempio n. 15
0
        public void Convert_ToSingle_EqualsValueAsSameType()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity));
        }
Esempio n. 16
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1);

            Assert.False(voltamperereactive.Equals(new object()));
        }
Esempio n. 17
0
        public void Convert_ToString_EqualsToString()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
Esempio n. 18
0
        public void EqualsReturnsFalseOnNull()
        {
            ReactivePower voltamperereactive = ReactivePower.FromVoltamperesReactive(1);

            Assert.False(voltamperereactive.Equals(null));
        }
Esempio n. 19
0
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(ReactivePower)));
        }
Esempio n. 20
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
Esempio n. 21
0
        public void Convert_ChangeType_QuantityType_EqualsQuantityType()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal(QuantityType.ReactivePower, Convert.ChangeType(quantity, typeof(QuantityType)));
        }
Esempio n. 22
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
Esempio n. 23
0
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
Esempio n. 24
0
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
Esempio n. 25
0
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(decimal value)
        {
            var quantity = ReactivePower.FromVoltamperesReactive(value);

            Assert.Equal(ReactivePower.FromVoltamperesReactive(-value), -quantity);
        }
Esempio n. 26
0
        public void Convert_ToDecimal_EqualsValueAsSameType()
        {
            var quantity = ReactivePower.FromVoltamperesReactive(1.0);

            Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity));
        }
 public void NumberToVoltamperesReactiveTest() =>
 Assert.Equal(ReactivePower.FromVoltamperesReactive(2), 2.VoltamperesReactive());
 /// <inheritdoc cref="ReactivePower.FromVoltamperesReactive(UnitsNet.QuantityValue)" />
 public static ReactivePower VoltamperesReactive(this double value) => ReactivePower.FromVoltamperesReactive(value);