Esempio n. 1
0
        public string TemperatureDeltaPlusTemperatureEqualsTemperature(TemperatureUnit unit, int deltaVal, int temperatureVal)
        {
            Temperature      temperature = Temperature.From(temperatureVal, unit);
            TemperatureDelta delta       = TemperatureDelta.From(deltaVal, (TemperatureDeltaUnit)unit);

            // Act
            Temperature resultTemp = delta + temperature;

            return(resultTemp.ToString(unit, CultureInfo.InvariantCulture, "{0:0} {1}"));
        }
Esempio n. 2
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsiusDelta).DegreesCelsiusDelta, DegreesCelsiusDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisleDelta).DegreesDelisleDelta, DegreesDelisleDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheitDelta).DegreesFahrenheitDelta, DegreesFahrenheitDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewtonDelta).DegreesNewtonDelta, DegreesNewtonDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankineDelta).DegreesRankineDelta, DegreesRankineDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumurDelta).DegreesReaumurDelta, DegreesReaumurDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemerDelta).DegreesRoemerDelta, DegreesRoemerDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.KelvinDelta).KelvinsDelta, KelvinsDeltaTolerance);
 }
Esempio n. 3
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisle).DegreesDelisle, DegreesDelisleTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumur).DegreesReaumur, DegreesReaumurTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemer).DegreesRoemer, DegreesRoemerTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance);
 }
Esempio n. 4
0
        public void TemperatureDeltaPlusTemperatureEqualsTemperature(TemperatureUnit unit, int deltaVal, int temperatureVal, string expected)
        {
            Temperature      temperature = Temperature.From(temperatureVal, unit);
            TemperatureDelta delta       = TemperatureDelta.From(deltaVal, (TemperatureDeltaUnit)unit);

            // Act
            Temperature resultTemp = delta + temperature;

            string actual = resultTemp.ToString(unit, CultureInfo.InvariantCulture, "{0:0} {1}");

            Assert.Equal(expected, actual);
        }
Esempio n. 5
0
        public void TemperaturePlusTemperatureDeltaEqualsTemperature(TemperatureUnit unit, int temperatureVal, int deltaVal, string expected)
        {
            Temperature      temperature = Temperature.From(temperatureVal, unit);
            TemperatureDelta delta       = TemperatureDelta.From(deltaVal, (TemperatureDeltaUnit)Enum.Parse(typeof(TemperatureDeltaUnit), unit.ToString()));

            // Act
            Temperature resultTemp = temperature + delta;

            string actual = resultTemp.ToUnit(unit).ToString(CultureInfo.InvariantCulture, "{0:0} {1}");

            Assert.Equal(expected, actual);
        }
Esempio n. 6
0
 public void FromValueAndUnit()
 {
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsius).DegreesCelsius, DegreesCelsiusTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsiusDelta).DegreesCelsiusDelta, DegreesCelsiusDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheit).DegreesFahrenheit, DegreesFahrenheitTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheitDelta).DegreesFahrenheitDelta, DegreesFahrenheitDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewton).DegreesNewton, DegreesNewtonTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewtonDelta).DegreesNewtonDelta, DegreesNewtonDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankine).DegreesRankine, DegreesRankineTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankineDelta).DegreesRankineDelta, DegreesRankineDeltaTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin).Kelvins, KelvinsTolerance);
     AssertEx.EqualTolerance(1, TemperatureDelta.From(1, TemperatureDeltaUnit.KelvinDelta).KelvinsDelta, KelvinsDeltaTolerance);
 }
Esempio n. 7
0
        public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
        {
            var quantity00 = TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeCelsius);

            AssertEx.EqualTolerance(1, quantity00.DegreesCelsius, DegreesCelsiusTolerance);
            Assert.Equal(TemperatureDeltaUnit.DegreeCelsius, quantity00.Unit);

            var quantity01 = TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeDelisle);

            AssertEx.EqualTolerance(1, quantity01.DegreesDelisle, DegreesDelisleTolerance);
            Assert.Equal(TemperatureDeltaUnit.DegreeDelisle, quantity01.Unit);

            var quantity02 = TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeFahrenheit);

            AssertEx.EqualTolerance(1, quantity02.DegreesFahrenheit, DegreesFahrenheitTolerance);
            Assert.Equal(TemperatureDeltaUnit.DegreeFahrenheit, quantity02.Unit);

            var quantity03 = TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeNewton);

            AssertEx.EqualTolerance(1, quantity03.DegreesNewton, DegreesNewtonTolerance);
            Assert.Equal(TemperatureDeltaUnit.DegreeNewton, quantity03.Unit);

            var quantity04 = TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRankine);

            AssertEx.EqualTolerance(1, quantity04.DegreesRankine, DegreesRankineTolerance);
            Assert.Equal(TemperatureDeltaUnit.DegreeRankine, quantity04.Unit);

            var quantity05 = TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeReaumur);

            AssertEx.EqualTolerance(1, quantity05.DegreesReaumur, DegreesReaumurTolerance);
            Assert.Equal(TemperatureDeltaUnit.DegreeReaumur, quantity05.Unit);

            var quantity06 = TemperatureDelta.From(1, TemperatureDeltaUnit.DegreeRoemer);

            AssertEx.EqualTolerance(1, quantity06.DegreesRoemer, DegreesRoemerTolerance);
            Assert.Equal(TemperatureDeltaUnit.DegreeRoemer, quantity06.Unit);

            var quantity07 = TemperatureDelta.From(1, TemperatureDeltaUnit.Kelvin);

            AssertEx.EqualTolerance(1, quantity07.Kelvins, KelvinsTolerance);
            Assert.Equal(TemperatureDeltaUnit.Kelvin, quantity07.Unit);

            var quantity08 = TemperatureDelta.From(1, TemperatureDeltaUnit.MillidegreeCelsius);

            AssertEx.EqualTolerance(1, quantity08.MillidegreesCelsius, MillidegreesCelsiusTolerance);
            Assert.Equal(TemperatureDeltaUnit.MillidegreeCelsius, quantity08.Unit);
        }