public void Convert_ToSingle_EqualsValueAsSameType()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity));
        }
Esempio n. 2
0
        public void EqualsReturnsFalseOnNull()
        {
            MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1);

            Assert.False(joulepermole.Equals(null));
        }
Esempio n. 3
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
Esempio n. 4
0
        public void CompareToThrowsOnTypeMismatch()
        {
            MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1);

            Assert.Throws <ArgumentException>(() => joulepermole.CompareTo(new object()));
        }
Esempio n. 5
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = MolarEnergy.FromJoulesPerMole(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(MolarEnergy.FromJoulesPerMole(1), -1, ComparisonType.Relative));
        }
Esempio n. 6
0
 /// <inheritdoc cref="MolarEnergy.FromKilojoulesPerMole(double?)"/>
 public static MolarEnergy?KilojoulesPerMole(this double?value) => MolarEnergy.FromKilojoulesPerMole(value);
Esempio n. 7
0
 public void FromJoulesPerMole_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => MolarEnergy.FromJoulesPerMole(double.NaN));
 }
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal(MolarEnergy.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
Esempio n. 10
0
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(MolarEnergyUnit)));
        }
Esempio n. 11
0
        public void Convert_ChangeType_QuantityType_EqualsQuantityType()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal(QuantityType.MolarEnergy, Convert.ChangeType(quantity, typeof(QuantityType)));
        }
Esempio n. 12
0
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(MolarEnergy)));
        }
Esempio n. 13
0
        public void Convert_ToUInt64_EqualsValueAsSameType()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity));
        }
Esempio n. 14
0
        public void Convert_ToString_EqualsToString()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
Esempio n. 15
0
 /// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double?)"/>
 public static MolarEnergy?JoulesPerMole(this decimal?value) => MolarEnergy.FromJoulesPerMole(value == null ? (double?)null : Convert.ToDouble(value.Value));
Esempio n. 16
0
        public void GetHashCode_Equals()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal(new { MolarEnergy.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
Esempio n. 17
0
 /// <inheritdoc cref="MolarEnergy.FromKilojoulesPerMole(double)"/>
 public static MolarEnergy KilojoulesPerMole(this long value) => MolarEnergy.FromKilojoulesPerMole(value);
Esempio n. 18
0
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(decimal value)
        {
            var quantity = MolarEnergy.FromJoulesPerMole(value);

            Assert.Equal(MolarEnergy.FromJoulesPerMole(-value), -quantity);
        }
Esempio n. 19
0
 public void FromJoulesPerMole_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => MolarEnergy.FromJoulesPerMole(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => MolarEnergy.FromJoulesPerMole(double.NegativeInfinity));
 }
Esempio n. 20
0
 /// <inheritdoc cref="MolarEnergy.FromMegajoulesPerMole(double?)"/>
 public static MolarEnergy?MegajoulesPerMole(this double?value) => MolarEnergy.FromMegajoulesPerMole(value);
Esempio n. 21
0
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = MolarEnergy.FromJoulesPerMole(1).ToBaseUnit();

            Assert.Equal(MolarEnergy.BaseUnit, quantityInBaseUnit.Unit);
        }
Esempio n. 22
0
 /// <inheritdoc cref="MolarEnergy.FromMegajoulesPerMole(double)"/>
 public static MolarEnergy MegajoulesPerMole(this float value) => MolarEnergy.FromMegajoulesPerMole(value);
Esempio n. 23
0
        public void CompareToThrowsOnNull()
        {
            MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1);

            Assert.Throws <ArgumentNullException>(() => joulepermole.CompareTo(null));
        }
Esempio n. 24
0
 /// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double)"/>
 public static MolarEnergy JoulesPerMole(this double value) => MolarEnergy.FromJoulesPerMole(value);
Esempio n. 25
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            MolarEnergy joulepermole = MolarEnergy.FromJoulesPerMole(1);

            Assert.False(joulepermole.Equals(new object()));
        }
Esempio n. 26
0
 /// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double?)"/>
 public static MolarEnergy?JoulesPerMole(this float?value) => MolarEnergy.FromJoulesPerMole(value);
Esempio n. 27
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
Esempio n. 28
0
 /// <inheritdoc cref="MolarEnergy.FromJoulesPerMole(double)"/>
 public static MolarEnergy JoulesPerMole(this decimal value) => MolarEnergy.FromJoulesPerMole(Convert.ToDouble(value));
Esempio n. 29
0
        public void Convert_ToBool_ThrowsInvalidCastException()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToBoolean(quantity));
        }
Esempio n. 30
0
        public void Convert_ToInt32_EqualsValueAsSameType()
        {
            var quantity = MolarEnergy.FromJoulesPerMole(1.0);

            Assert.Equal((int)quantity.Value, Convert.ToInt32(quantity));
        }