예제 #1
0
        public void Convert_ToString_EqualsToString()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
예제 #2
0
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
예제 #3
0
        public void Convert_ToInt64_EqualsValueAsSameType()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal((long)quantity.Value, Convert.ToInt64(quantity));
        }
예제 #4
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            Permeability henrypermeter = Permeability.FromHenriesPerMeter(1);

            Assert.False(henrypermeter.Equals(new object()));
        }
예제 #5
0
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
예제 #6
0
        public void ConversionRoundTrip()
        {
            Permeability henrypermeter = Permeability.FromHenriesPerMeter(1);

            AssertEx.EqualTolerance(1, Permeability.FromHenriesPerMeter(henrypermeter.HenriesPerMeter).HenriesPerMeter, HenriesPerMeterTolerance);
        }
예제 #7
0
        public void CompareToThrowsOnNull()
        {
            Permeability henrypermeter = Permeability.FromHenriesPerMeter(1);

            Assert.Throws <ArgumentNullException>(() => henrypermeter.CompareTo(null));
        }
예제 #8
0
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
예제 #9
0
        public void GetHashCode_Equals()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal(new { Permeability.Info.Name, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
예제 #10
0
        public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal(Permeability.Info, Convert.ChangeType(quantity, typeof(QuantityInfo)));
        }
예제 #11
0
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal(Permeability.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
예제 #12
0
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(PermeabilityUnit)));
        }
예제 #13
0
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(Permeability)));
        }
예제 #14
0
        public void Convert_ToUInt32_EqualsValueAsSameType()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal((uint)quantity.Value, Convert.ToUInt32(quantity));
        }
예제 #15
0
        public void As()
        {
            var henrypermeter = Permeability.FromHenriesPerMeter(1);

            AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.As(PermeabilityUnit.HenryPerMeter), HenriesPerMeterTolerance);
        }
예제 #16
0
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value)
        {
            var quantity = Permeability.FromHenriesPerMeter(value);

            Assert.Equal(Permeability.FromHenriesPerMeter(-value), -quantity);
        }
예제 #17
0
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = Permeability.FromHenriesPerMeter(1).ToBaseUnit();

            Assert.Equal(Permeability.BaseUnit, quantityInBaseUnit.Unit);
        }
 public void NumberToHenriesPerMeterTest() =>
 Assert.Equal(Permeability.FromHenriesPerMeter(2), 2.HenriesPerMeter());
예제 #19
0
        public void CompareToThrowsOnTypeMismatch()
        {
            Permeability henrypermeter = Permeability.FromHenriesPerMeter(1);

            Assert.Throws <ArgumentException>(() => henrypermeter.CompareTo(new object()));
        }
예제 #20
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, Permeability.From(1, PermeabilityUnit.HenryPerMeter).HenriesPerMeter, HenriesPerMeterTolerance);
 }
예제 #21
0
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = Permeability.FromHenriesPerMeter(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(Permeability.FromHenriesPerMeter(1), -1, ComparisonType.Relative));
        }
예제 #22
0
 /// <inheritdoc cref="Permeability.FromHenriesPerMeter(UnitsNet.QuantityValue)" />
 public static Permeability HenriesPerMeter <T>(this T value) => Permeability.FromHenriesPerMeter(Convert.ToDouble(value));
예제 #23
0
        public void EqualsReturnsFalseOnNull()
        {
            Permeability henrypermeter = Permeability.FromHenriesPerMeter(1);

            Assert.False(henrypermeter.Equals(null));
        }
예제 #24
0
        public void HenryPerMeterToPermeabilityUnits()
        {
            Permeability henrypermeter = Permeability.FromHenriesPerMeter(1);

            AssertEx.EqualTolerance(HenriesPerMeterInOneHenryPerMeter, henrypermeter.HenriesPerMeter, HenriesPerMeterTolerance);
        }
예제 #25
0
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
예제 #26
0
 public void FromHenriesPerMeter_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => Permeability.FromHenriesPerMeter(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => Permeability.FromHenriesPerMeter(double.NegativeInfinity));
 }
예제 #27
0
        public void Convert_ToDecimal_EqualsValueAsSameType()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal((decimal)quantity.Value, Convert.ToDecimal(quantity));
        }
예제 #28
0
 public void FromHenriesPerMeter_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => Permeability.FromHenriesPerMeter(double.NaN));
 }
예제 #29
0
        public void Convert_ToSByte_EqualsValueAsSameType()
        {
            var quantity = Permeability.FromHenriesPerMeter(1.0);

            Assert.Equal((sbyte)quantity.Value, Convert.ToSByte(quantity));
        }
예제 #30
0
        public void ToUnit_WithNullUnitSystem_ThrowsNullException()
        {
            var henrypermeter = Permeability.FromHenriesPerMeter(1);

            Assert.Throws <ArgumentNullException>(() => henrypermeter.ToUnit(null));
        }