コード例 #1
0
        public void Convert_ToSingle_EqualsValueAsSameType()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal((float)quantity.Value, Convert.ToSingle(quantity));
        }
コード例 #2
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromCentimetersToTheFourth(double?)"/>
 public static AreaMomentOfInertia?CentimetersToTheFourth(this float?value) => AreaMomentOfInertia.FromCentimetersToTheFourth(value);
コード例 #3
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromCentimetersToTheFourth(double?)"/>
 public static AreaMomentOfInertia?CentimetersToTheFourth(this decimal?value) => AreaMomentOfInertia.FromCentimetersToTheFourth(value == null ? (double?)null : Convert.ToDouble(value.Value));
コード例 #4
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromMetersToTheFourth(double?)"/>
 public static AreaMomentOfInertia?MetersToTheFourth(this long?value) => AreaMomentOfInertia.FromMetersToTheFourth(value);
コード例 #5
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromMillimetersToTheFourth(double)"/>
 public static AreaMomentOfInertia MillimetersToTheFourth(this float value) => AreaMomentOfInertia.FromMillimetersToTheFourth(value);
コード例 #6
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromFeetToTheFourth(double?)"/>
 public static AreaMomentOfInertia?FeetToTheFourth(this float?value) => AreaMomentOfInertia.FromFeetToTheFourth(value);
コード例 #7
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromInchesToTheFourth(double?)"/>
 public static AreaMomentOfInertia?InchesToTheFourth(this float?value) => AreaMomentOfInertia.FromInchesToTheFourth(value);
コード例 #8
0
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(AreaMomentOfInertia.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
コード例 #9
0
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
コード例 #10
0
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(AreaMomentOfInertiaUnit)));
        }
コード例 #11
0
        public void Convert_ChangeType_QuantityInfo_EqualsQuantityInfo()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(AreaMomentOfInertia.Info, Convert.ChangeType(quantity, typeof(QuantityInfo)));
        }
コード例 #12
0
        public void Convert_ChangeType_SelfType_EqualsSelf()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(quantity, Convert.ChangeType(quantity, typeof(AreaMomentOfInertia)));
        }
コード例 #13
0
        public void Convert_ToUInt64_EqualsValueAsSameType()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity));
        }
コード例 #14
0
        public void Convert_ToString_EqualsToString()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
コード例 #15
0
        public void AreaMomentOfInertiaDividedByLengthEqualsVolume()
        {
            Volume volume = AreaMomentOfInertia.FromMetersToTheFourth(20) / Length.FromMeters(10);

            Assert.Equal(Volume.FromCubicMeters(2), volume);
        }
コード例 #16
0
        public void GetHashCode_Equals()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal(new { AreaMomentOfInertia.Info.Name, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
コード例 #17
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromFeetToTheFourth(double)"/>
 public static AreaMomentOfInertia FeetToTheFourth(this double value) => AreaMomentOfInertia.FromFeetToTheFourth(value);
コード例 #18
0
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value)
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(value);

            Assert.Equal(AreaMomentOfInertia.FromMetersToTheFourth(-value), -quantity);
        }
コード例 #19
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromInchesToTheFourth(double)"/>
 public static AreaMomentOfInertia InchesToTheFourth(this double value) => AreaMomentOfInertia.FromInchesToTheFourth(value);
コード例 #20
0
        public void ArithmeticOperators()
        {
            AreaMomentOfInertia v = AreaMomentOfInertia.FromMetersToTheFourth(1);

            AssertEx.EqualTolerance(-1, -v.MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(3) - v).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, (v + v).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(10, (v * 10).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(10, (10 * v).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, (AreaMomentOfInertia.FromMetersToTheFourth(10) / 5).MetersToTheFourth, MetersToTheFourthTolerance);
            AssertEx.EqualTolerance(2, AreaMomentOfInertia.FromMetersToTheFourth(10) / AreaMomentOfInertia.FromMetersToTheFourth(5), MetersToTheFourthTolerance);
        }
コード例 #21
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromInchesToTheFourth(double)"/>
 public static AreaMomentOfInertia InchesToTheFourth(this decimal value) => AreaMomentOfInertia.FromInchesToTheFourth(Convert.ToDouble(value));
コード例 #22
0
        public void CompareToThrowsOnTypeMismatch()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.Throws <ArgumentException>(() => metertothefourth.CompareTo(new object()));
        }
コード例 #23
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromMillimetersToTheFourth(double?)"/>
 public static AreaMomentOfInertia?MillimetersToTheFourth(this double?value) => AreaMomentOfInertia.FromMillimetersToTheFourth(value);
コード例 #24
0
        public void CompareToThrowsOnNull()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.Throws <ArgumentNullException>(() => metertothefourth.CompareTo(null));
        }
コード例 #25
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromCentimetersToTheFourth(double)"/>
 public static AreaMomentOfInertia CentimetersToTheFourth(this double value) => AreaMomentOfInertia.FromCentimetersToTheFourth(value);
コード例 #26
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.False(metertothefourth.Equals(new object()));
        }
コード例 #27
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromCentimetersToTheFourth(double)"/>
 public static AreaMomentOfInertia CentimetersToTheFourth(this decimal value) => AreaMomentOfInertia.FromCentimetersToTheFourth(Convert.ToDouble(value));
コード例 #28
0
        public void EqualsReturnsFalseOnNull()
        {
            AreaMomentOfInertia metertothefourth = AreaMomentOfInertia.FromMetersToTheFourth(1);

            Assert.False(metertothefourth.Equals(null));
        }
コード例 #29
0
 /// <inheritdoc cref="AreaMomentOfInertia.FromDecimetersToTheFourth(double)"/>
 public static AreaMomentOfInertia DecimetersToTheFourth(this int value) => AreaMomentOfInertia.FromDecimetersToTheFourth(value);
コード例 #30
0
        public void Convert_ToInt16_EqualsValueAsSameType()
        {
            var quantity = AreaMomentOfInertia.FromMetersToTheFourth(1.0);

            Assert.Equal((short)quantity.Value, Convert.ToInt16(quantity));
        }