public void Test_to_gas_generic_from_celsius_returns_correct_value(int input, int expected)
        {
            // Arrange.
            var inputCelsius = new CelsiusInt(input);

            // Act.
            var result = inputCelsius.To <Gas>();

            // Assert.
            result.Should().Be(expected);
        }
        public void Test_to_celsius_generic_from_celsius_returns_same_value()
        {
            // Arrange.
            var input = new CelsiusInt(42);

            // Act.
            var result = input.To <Celsius>();

            // Assert.
            result.Should().Be(input.Temperature);
        }
        public void Test_to_fahrenheit_generic_from_celsius_with_invalid_parameter_throws_exception(int input)
        {
            // Arrange.
            var inputCelsius = new CelsiusInt(input);

            // Act.
            var result = Assert.Throws <ArgumentOutOfRangeException>(() => inputCelsius.To <Fahrenheit>());

            // Assert.
            result.Message.Should().Contain("Value out of range for type.");
        }
        public void Test_to_rankine_generic_from_celsius_returns_correct_value()
        {
            // Arrange.
            const int expected = 852;
            var       input    = new CelsiusInt(200);

            // Act.
            var result = input.To <Rankine>();

            // Assert.
            result.Should().Be(expected);
        }
        public void Test_to_kelvin_from_celsius_returns_correct_value()
        {
            // Arrange.
            const int expected = 473;
            var       input    = new CelsiusInt(200);

            // Act.
            var result = input.ToKelvin();

            // Assert.
            result.Should().Be(expected);
        }
        public void Test_to_fahrenheit_generic_from_celsius_returns_correct_value()
        {
            // Arrange.
            const int expected = 54;
            var       input    = new CelsiusInt(12);

            // Act.
            var result = input.To <Fahrenheit>();

            // Assert.
            result.Should().Be(expected);
        }
예제 #7
0
 /// <summary>
 /// Converts the Celsius <paramref name="input"/> to FahrenheitConverter
 /// </summary>
 /// <param name="input"> The value to be converted. </param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">If calculated value is beyond the limits of the type.</exception>
 /// <returns>
 /// The FahrenheitConverter <see langword="int"/> result.
 /// </returns>
 public static int ToFahrenheit(this CelsiusInt input)
 {
     return(IntParser(CelsiusConverter.CelsiusToFahrenheit(input.Temperature)));
 }
예제 #8
0
 /// <summary>
 /// Converts the Celsius <paramref name="input"/> to RankineConverter
 /// </summary>
 /// <param name="input"> The value to be converted. </param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">If calculated value is beyond the limits of the type.</exception>
 /// <returns>
 /// The RankineConverter <see langword="int"/> result.
 /// </returns>
 public static int ToRankine(this CelsiusInt input)
 {
     return(IntParser(CelsiusConverter.CelsiusToRankine(input.Temperature)));
 }