Exemplo n.º 1
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.JoulePerMoleKelvin).JoulesPerMoleKelvin, JoulesPerMoleKelvinTolerance);
     AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.KilojoulePerMoleKelvin).KilojoulesPerMoleKelvin, KilojoulesPerMoleKelvinTolerance);
     AssertEx.EqualTolerance(1, MolarEntropy.From(1, MolarEntropyUnit.MegajoulePerMoleKelvin).MegajoulesPerMoleKelvin, MegajoulesPerMoleKelvinTolerance);
 }
Exemplo n.º 2
0
        public void Convert_ToInt16_EqualsValueAsSameType()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity));
        }
Exemplo n.º 3
0
        public void Convert_ToString_EqualsToString()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
Exemplo n.º 4
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
Exemplo n.º 5
0
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
Exemplo n.º 6
0
        public void CompareToThrowsOnNull()
        {
            MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1);

            Assert.Throws <ArgumentNullException>(() => joulepermolekelvin.CompareTo(null));
        }
Exemplo n.º 7
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1);

            Assert.False(joulepermolekelvin.Equals(new object()));
        }
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

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

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(MolarEntropyUnit)));
        }
        public void Convert_ChangeType_QuantityType_EqualsQuantityType()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal(QuantityType.MolarEntropy, Convert.ChangeType(quantity, typeof(QuantityType)));
        }
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(MolarEntropy)));
        }
        public void FromJoulesPerMoleKelvin_WithNanValue_CreateQuantityAndAffectNaNValue()
        {
            var nanQuantity = MolarEntropy.FromJoulesPerMoleKelvin(double.NaN);

            Assert.True(double.IsNaN(nanQuantity.Value));
        }
 public static MolarEntropy KilojoulesPerMoleKelvin <T>(this T value) =>
 MolarEntropy.FromKilojoulesPerMoleKelvin(Convert.ToDouble(value));
Exemplo n.º 15
0
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = MolarEntropy.FromJoulesPerMoleKelvin(1).ToBaseUnit();

            Assert.Equal(MolarEntropy.BaseUnit, quantityInBaseUnit.Unit);
        }
        public void GetHashCode_Equals()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal(new { MolarEntropy.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
Exemplo n.º 17
0
        public void CompareToThrowsOnTypeMismatch()
        {
            MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1);

            Assert.Throws <ArgumentException>(() => joulepermolekelvin.CompareTo(new object()));
        }
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value)
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(value);

            Assert.Equal(MolarEntropy.FromJoulesPerMoleKelvin(-value), -quantity);
        }
Exemplo n.º 19
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = MolarEntropy.FromJoulesPerMoleKelvin(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(MolarEntropy.FromJoulesPerMoleKelvin(1), -1, ComparisonType.Relative));
        }
        public void Ctor_WithNaNValue_CreateQuantityAndAffectNaNValue()
        {
            var nanQuantity = new MolarEntropy(double.NaN, MolarEntropyUnit.JoulePerMoleKelvin);

            Assert.True(double.IsNaN(nanQuantity.Value));
        }
Exemplo n.º 21
0
        public void EqualsReturnsFalseOnNull()
        {
            MolarEntropy joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1);

            Assert.False(joulepermolekelvin.Equals(null));
        }
Exemplo n.º 22
0
 public static MolarEntropy MegajoulesPerMoleKelvin <T>(this T value) =>
 MolarEntropy.FromMegajoulesPerMoleKelvin(Convert.ToDecimal(value));
Exemplo n.º 23
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
Exemplo n.º 24
0
 public void FromJoulesPerMoleKelvin_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => MolarEntropy.FromJoulesPerMoleKelvin(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NegativeInfinity));
 }
Exemplo n.º 25
0
        public void Convert_ToDecimal_EqualsValueAsSameType()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity));
        }
Exemplo n.º 26
0
 public void FromJoulesPerMoleKelvin_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => MolarEntropy.FromJoulesPerMoleKelvin(double.NaN));
 }
Exemplo n.º 27
0
        public void Convert_ToSingle_EqualsValueAsSameType()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity));
        }
Exemplo n.º 28
0
        public void ToUnit_WithNullUnitSystem_ThrowsNullException()
        {
            var joulepermolekelvin = MolarEntropy.FromJoulesPerMoleKelvin(1);

            Assert.Throws <ArgumentNullException>(() => joulepermolekelvin.ToUnit(null));
        }
Exemplo n.º 29
0
        public void Convert_ToUInt64_EqualsValueAsSameType()
        {
            var quantity = MolarEntropy.FromJoulesPerMoleKelvin(1.0);

            Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity));
        }
Exemplo n.º 30
0
 public static MolarEntropy?MegajoulesPerMoleKelvin <T>(this T?value) where T : struct => MolarEntropy.FromMegajoulesPerMoleKelvin(value == null ? (double?)null : Convert.ToDouble(value.Value));