public void FromInverseMeters_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ReciprocalLength.FromInverseMeters(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => ReciprocalLength.FromInverseMeters(double.NegativeInfinity));
 }
 public void FromInverseMeters_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ReciprocalLength.FromInverseMeters(double.NaN));
 }
        public void Convert_ToBool_ThrowsInvalidCastException()
        {
            var quantity = ReciprocalLength.FromInverseMeters(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToBoolean(quantity));
        }
 public void NumberToInverseUsSurveyFeetTest() =>
 Assert.Equal(ReciprocalLength.FromInverseUsSurveyFeet(2), 2.InverseUsSurveyFeet());
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            ReciprocalLength inversemeter = ReciprocalLength.FromInverseMeters(1);

            Assert.False(inversemeter.Equals(new object()));
        }
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = ReciprocalLength.FromInverseMeters(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
Exemple #7
0
        public static void ReciprocalLengthTimesForcePerLengthEqualsPressure()
        {
            Pressure pressure = ReciprocalLength.FromInverseMeters(5) * ForcePerLength.FromNewtonsPerMeter(10);

            Assert.Equal(pressure, Pressure.FromNewtonsPerSquareMeter(50));
        }
        public void CompareToThrowsOnNull()
        {
            ReciprocalLength inversemeter = ReciprocalLength.FromInverseMeters(1);

            Assert.Throws <ArgumentNullException>(() => inversemeter.CompareTo(null));
        }
Exemple #9
0
        public static void ForcePerLengthDividedByReciprocalLengthEqualsForce()
        {
            Force force = ForcePerLength.FromNewtonsPerMeter(10) / ReciprocalLength.FromInverseMeters(5);

            Assert.Equal(force, Force.FromNewtons(2));
        }
Exemple #10
0
        public static void PressureDividedByReciprocalLengthEqualsForcePerLength()
        {
            ForcePerLength forcePerLength = Pressure.FromPascals(50) / ReciprocalLength.FromInverseMeters(5);

            Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(10));
        }
Exemple #11
0
        public void ReciprocalLengthDividedByReciprocalAreaEqualsLength()
        {
            Length length = ReciprocalLength.FromInverseMeters(5) / ReciprocalArea.FromInverseSquareMeters(10);

            Assert.Equal(length, Length.FromMeters(0.5));
        }
Exemple #12
0
        public void ReciprocalLengthTimesReciprocalLengthEqualsReciprocalArea()
        {
            ReciprocalArea reciprocalArea = ReciprocalLength.FromInverseMeters(10) * ReciprocalLength.FromInverseMeters(20);

            Assert.Equal(reciprocalArea, ReciprocalArea.FromInverseSquareMeters(200));
        }
 public void NumberToInverseYardsTest() =>
 Assert.Equal(ReciprocalLength.FromInverseYards(2), 2.InverseYards());
        public void ToBaseUnit_ReturnsQuantityWithBaseUnit()
        {
            var quantityInBaseUnit = ReciprocalLength.FromInverseMeters(1).ToBaseUnit();

            Assert.Equal(ReciprocalLength.BaseUnit, quantityInBaseUnit.Unit);
        }
Exemple #15
0
        public static void ReciprocalLengthTimesForceEqualsForcePerLength()
        {
            ForcePerLength forcePerLength = ReciprocalLength.FromInverseMeters(5) * Force.FromNewtons(10);

            Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(50));
        }
        public void CompareToThrowsOnTypeMismatch()
        {
            ReciprocalLength inversemeter = ReciprocalLength.FromInverseMeters(1);

            Assert.Throws <ArgumentException>(() => inversemeter.CompareTo(new object()));
        }
Exemple #17
0
        public void ReciprocalAreaDividedByReciprocalLengthEqualsReciprocalLength()
        {
            ReciprocalLength reciprocalLength = ReciprocalArea.FromInverseSquareMeters(10) / ReciprocalLength.FromInverseMeters(0.5);

            Assert.Equal(reciprocalLength, ReciprocalLength.FromInverseMeters(20));
        }
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = ReciprocalLength.FromInverseMeters(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(ReciprocalLength.FromInverseMeters(1), -1, ComparisonType.Relative));
        }
 public static ReciprocalLength InverseMicroinches <T>(this T value) =>
 ReciprocalLength.FromInverseMicroinches(Convert.ToDouble(value));
        public void EqualsReturnsFalseOnNull()
        {
            ReciprocalLength inversemeter = ReciprocalLength.FromInverseMeters(1);

            Assert.False(inversemeter.Equals(null));
        }
 public static ReciprocalLength InverseUsSurveyFeet <T>(this T value) =>
 ReciprocalLength.FromInverseUsSurveyFeet(Convert.ToDouble(value));
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = ReciprocalLength.FromInverseMeters(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
 public static ReciprocalLength InverseYards <T>(this T value) =>
 ReciprocalLength.FromInverseYards(Convert.ToDouble(value));
        public void Convert_ToByte_EqualsValueAsSameType()
        {
            var quantity = ReciprocalLength.FromInverseMeters(1.0);

            Assert.Equal((byte)quantity.Value, Convert.ToByte(quantity));
        }
 public void NumberToInverseMicroinchesTest() =>
 Assert.Equal(ReciprocalLength.FromInverseMicroinches(2), 2.InverseMicroinches());