public void Equals_RelativeTolerance_IsImplemented()
        {
            var v = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            Assert.True(v.Equals(ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1), SquareMeterCelciusDegreePerKilowattsTolerance, ComparisonType.Relative));
            Assert.False(v.Equals(ThermalInsulance.Zero, SquareMeterCelciusDegreePerKilowattsTolerance, ComparisonType.Relative));
        }
        public void Equals_SameType_IsImplemented()
        {
            var a = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);
            var b = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(2);

            Assert.True(a.Equals(a));
            Assert.False(a.Equals(b));
        }
        public void CompareToIsImplemented()
        {
            ThermalInsulance squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            Assert.Equal(0, squaremetercelciusdegreeperkilowatt.CompareTo(squaremetercelciusdegreeperkilowatt));
            Assert.True(squaremetercelciusdegreeperkilowatt.CompareTo(ThermalInsulance.Zero) > 0);
            Assert.True(ThermalInsulance.Zero.CompareTo(squaremetercelciusdegreeperkilowatt) < 0);
        }
        public void ToUnit()
        {
            var squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            var squaremetercelciusdegreeperkilowattQuantity = squaremetercelciusdegreeperkilowatt.ToUnit(ThermalInsulanceUnit.SquareMeterCelciusDegreePerKilowatt);

            AssertEx.EqualTolerance(SquareMeterCelciusDegreePerKilowattsInOneSquareMeterCelciusDegreePerKilowatt, (double)squaremetercelciusdegreeperkilowattQuantity.Value, SquareMeterCelciusDegreePerKilowattsTolerance);
            Assert.Equal(ThermalInsulanceUnit.SquareMeterCelciusDegreePerKilowatt, squaremetercelciusdegreeperkilowattQuantity.Unit);
        }
        public void Equals_QuantityAsObject_IsImplemented()
        {
            object a = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);
            object b = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(2);

            Assert.True(a.Equals(a));
            Assert.False(a.Equals(b));
            Assert.False(a.Equals((object)null));
        }
        public void ArithmeticOperators()
        {
            ThermalInsulance v = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            AssertEx.EqualTolerance(-1, -v.SquareMeterCelciusDegreePerKilowatts, SquareMeterCelciusDegreePerKilowattsTolerance);
            AssertEx.EqualTolerance(2, (ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(3) - v).SquareMeterCelciusDegreePerKilowatts, SquareMeterCelciusDegreePerKilowattsTolerance);
            AssertEx.EqualTolerance(2, (v + v).SquareMeterCelciusDegreePerKilowatts, SquareMeterCelciusDegreePerKilowattsTolerance);
            AssertEx.EqualTolerance(10, (v * 10).SquareMeterCelciusDegreePerKilowatts, SquareMeterCelciusDegreePerKilowattsTolerance);
            AssertEx.EqualTolerance(10, (10 * v).SquareMeterCelciusDegreePerKilowatts, SquareMeterCelciusDegreePerKilowattsTolerance);
            AssertEx.EqualTolerance(2, (ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(10) / 5).SquareMeterCelciusDegreePerKilowatts, SquareMeterCelciusDegreePerKilowattsTolerance);
            AssertEx.EqualTolerance(2, ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(10) / ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(5), SquareMeterCelciusDegreePerKilowattsTolerance);
        }
        public void ComparisonOperators()
        {
            ThermalInsulance oneSquareMeterCelciusDegreePerKilowatt  = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);
            ThermalInsulance twoSquareMeterCelciusDegreePerKilowatts = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(2);

            Assert.True(oneSquareMeterCelciusDegreePerKilowatt < twoSquareMeterCelciusDegreePerKilowatts);
            Assert.True(oneSquareMeterCelciusDegreePerKilowatt <= twoSquareMeterCelciusDegreePerKilowatts);
            Assert.True(twoSquareMeterCelciusDegreePerKilowatts > oneSquareMeterCelciusDegreePerKilowatt);
            Assert.True(twoSquareMeterCelciusDegreePerKilowatts >= oneSquareMeterCelciusDegreePerKilowatt);

            Assert.False(oneSquareMeterCelciusDegreePerKilowatt > twoSquareMeterCelciusDegreePerKilowatts);
            Assert.False(oneSquareMeterCelciusDegreePerKilowatt >= twoSquareMeterCelciusDegreePerKilowatts);
            Assert.False(twoSquareMeterCelciusDegreePerKilowatts < oneSquareMeterCelciusDegreePerKilowatt);
            Assert.False(twoSquareMeterCelciusDegreePerKilowatts <= oneSquareMeterCelciusDegreePerKilowatt);
        }
        public void EqualityOperators()
        {
            var a = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);
            var b = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(2);

            // ReSharper disable EqualExpressionComparison

            Assert.True(a == a);
            Assert.False(a != a);

            Assert.True(a != b);
            Assert.False(a == b);

            Assert.False(a == null);
            Assert.False(null == a);

// ReSharper restore EqualExpressionComparison
        }
        public void Convert_ToString_EqualsToString()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Equal(quantity.ToString(), Convert.ToString(quantity));
        }
        public void Convert_ToDateTime_ThrowsInvalidCastException()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ToDateTime(quantity));
        }
        public void ToString_NullProvider_EqualsCurrentUICulture()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Equal(quantity.ToString(CultureInfo.CurrentUICulture, "g"), quantity.ToString(null, "g"));
        }
        public void ToString_NullArgs_ThrowsArgumentNullException()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Throws <ArgumentNullException>(() => quantity.ToString(null, "g", null));
        }
        public void EqualsReturnsFalseOnNull()
        {
            ThermalInsulance squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            Assert.False(squaremetercelciusdegreeperkilowatt.Equals(null));
        }
        public void Convert_ChangeType_QuantityType_EqualsQuantityType()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Equal(QuantityType.ThermalInsulance, Convert.ChangeType(quantity, typeof(QuantityType)));
        }
        public void NegationOperator_ReturnsQuantity_WithNegatedValue(double value)
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(value);

            Assert.Equal(ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(-value), -quantity);
        }
        public void Convert_ChangeType_InvalidType_ThrowsInvalidCastException()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Throws <InvalidCastException>(() => Convert.ChangeType(quantity, typeof(QuantityFormatter)));
        }
        public void As()
        {
            var squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            AssertEx.EqualTolerance(SquareMeterCelciusDegreePerKilowattsInOneSquareMeterCelciusDegreePerKilowatt, squaremetercelciusdegreeperkilowatt.As(ThermalInsulanceUnit.SquareMeterCelciusDegreePerKilowatt), SquareMeterCelciusDegreePerKilowattsTolerance);
        }
        public void CompareToThrowsOnNull()
        {
            ThermalInsulance squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            Assert.Throws <ArgumentNullException>(() => squaremetercelciusdegreeperkilowatt.CompareTo(null));
        }
        public void CompareToThrowsOnTypeMismatch()
        {
            ThermalInsulance squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            Assert.Throws <ArgumentException>(() => squaremetercelciusdegreeperkilowatt.CompareTo(new object()));
        }
        public void ConversionRoundTrip()
        {
            ThermalInsulance squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            AssertEx.EqualTolerance(1, ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(squaremetercelciusdegreeperkilowatt.SquareMeterCelciusDegreePerKilowatts).SquareMeterCelciusDegreePerKilowatts, SquareMeterCelciusDegreePerKilowattsTolerance);
        }
        public void Convert_ToUInt64_EqualsValueAsSameType()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Equal((ulong)quantity.Value, Convert.ToUInt64(quantity));
        }
        public void Convert_ChangeType_UnitType_EqualsUnit()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Equal(quantity.Unit, Convert.ChangeType(quantity, typeof(ThermalInsulanceUnit)));
        }
 public void FromSquareMeterCelciusDegreePerKilowatts_WithNanValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(double.NaN));
 }
        public void Convert_ChangeType_BaseDimensions_EqualsBaseDimensions()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Equal(ThermalInsulance.BaseDimensions, Convert.ChangeType(quantity, typeof(BaseDimensions)));
        }
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            ThermalInsulance squaremetercelciusdegreeperkilowatt = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            Assert.False(squaremetercelciusdegreeperkilowatt.Equals(new object()));
        }
        public void GetHashCode_Equals()
        {
            var quantity = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1.0);

            Assert.Equal(new { ThermalInsulance.QuantityType, quantity.Value, quantity.Unit }.GetHashCode(), quantity.GetHashCode());
        }
        public void Equals_NegativeRelativeTolerance_ThrowsArgumentOutOfRangeException()
        {
            var v = ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1);

            Assert.Throws <ArgumentOutOfRangeException>(() => v.Equals(ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(1), -1, ComparisonType.Relative));
        }
 public void NumberToSquareMeterCelciusDegreePerKilowattsTest() =>
 Assert.Equal(ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(2), 2.SquareMeterCelciusDegreePerKilowatts());
 public void FromSquareMeterCelciusDegreePerKilowatts_WithInfinityValue_ThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(double.PositiveInfinity));
     Assert.Throws <ArgumentException>(() => ThermalInsulance.FromSquareMeterCelciusDegreePerKilowatts(double.NegativeInfinity));
 }