<commit_before>﻿namespace StevenVolckaert.Tests
{
    using System;
    using System.Collections.Generic;
    using Xunit;

    public class UnitConvertTests
    {
        /// <summary>
        ///     A list of tuples that links degrees Celsius to degrees Fahrenheit.
        ///     Source http://www.rapidtables.com/convert/temperature/celsius-to-fahrenheit.htm
        /// </summary>
        private static readonly List<Tuple<int, int>> _temperatureTuples =
            new List<Tuple<int, int>>
            {
                Tuple.Create(-50, -58),
                Tuple.Create(-40, -40),
                Tuple.Create(-30, -22),
                Tuple.Create(-20, -4),
                Tuple.Create(-10, 14),
                Tuple.Create(-9, 16),
                Tuple.Create(-8, 18),
                Tuple.Create(-7, 19),
                Tuple.Create(-6, 21),
                Tuple.Create(-5, 23),
                Tuple.Create(-4, 25),
                Tuple.Create(-3, 27),
                Tuple.Create(-2, 28),
                Tuple.Create(-1, 30),
                Tuple.Create(0, 32),
                Tuple.Create(1, 34),
                Tuple.Create(2, 36),
                Tuple.Create(3, 37),
                Tuple.Create(4, 39),
                Tuple.Create(5, 41),
                Tuple.Create(6, 43),
                Tuple.Create(7, 45),
                Tuple.Create(8, 46),
                Tuple.Create(9, 48),
                Tuple.Create(10, 50),
                Tuple.Create(20, 68),
                Tuple.Create(21, 70),
                Tuple.Create(30, 86),
                Tuple.Create(37, 99),
                Tuple.Create(40, 104),
                Tuple.Create(50, 122),
                Tuple.Create(60, 140),
                Tuple.Create(70, 158),
                Tuple.Create(80, 176),
                Tuple.Create(90, 194),
                Tuple.Create(100, 212),
                Tuple.Create(200, 392),
                Tuple.Create(300, 572),
            };

        [Fact]
        public void FromCelsiusToFahrenheitTest()
        {
            _temperatureTuples.ForEach(
                x => Assert.Equal(x.Item2, UnitConvert.FromCelsiusToFahrenheit(x.Item1))
            );
        }

        [Fact]
        public void FromFahrenheitToCelsiusTest()
        {
            _temperatureTuples.ForEach(
                x => Assert.Equal(x.Item1, UnitConvert.FromFahrenheitToCelsius(x.Item2))
            );
        }
    }
}<commit_msg>Comparing facts to theories, using member data.<commit_after>﻿namespace StevenVolckaert.Tests
{
    using System.Collections.Generic;
    using Xunit;

    public class UnitConvertTests
    {
        /// <summary>
        ///     Returns a sequence of data that links degrees Celsius to degrees Fahrenheit.
        ///     Source http://www.rapidtables.com/convert/temperature/celsius-to-fahrenheit.htm
        /// </summary>
        public static IEnumerable<object[]> CelsiusToFahrenheitData()
        {
            yield return new object[] { -50, -58 };
            yield return new object[] { -40, -40 };
            yield return new object[] { -30, -22 };
            yield return new object[] { -20, -4 };
            yield return new object[] { -10, 14 };
            yield return new object[] { -9, 16 };
            yield return new object[] { -8, 18 };
            yield return new object[] { -7, 19 };
            yield return new object[] { -6, 21 };
            yield return new object[] { -5, 23 };
            yield return new object[] { -4, 25 };
            yield return new object[] { -3, 27 };
            yield return new object[] { -2, 28 };
            yield return new object[] { -1, 30 };
            yield return new object[] { 0, 32 };
            yield return new object[] { 1, 34 };
            yield return new object[] { 2, 36 };
            yield return new object[] { 3, 37 };
            yield return new object[] { 4, 39 };
            yield return new object[] { 5, 41 };
            yield return new object[] { 6, 43 };
            yield return new object[] { 7, 45 };
            yield return new object[] { 8, 46 };
            yield return new object[] { 9, 48 };
            yield return new object[] { 10, 50 };
            yield return new object[] { 20, 68 };
            yield return new object[] { 21, 70 };
            yield return new object[] { 30, 86 };
            yield return new object[] { 37, 99 };
            yield return new object[] { 40, 104 };
            yield return new object[] { 50, 122 };
            yield return new object[] { 60, 140 };
            yield return new object[] { 70, 158 };
            yield return new object[] { 80, 176 };
            yield return new object[] { 90, 194 };
            yield return new object[] { 100, 212 };
            yield return new object[] { 200, 392 };
            yield return new object[] { 300, 572 };
        }

        [Theory]
        [MemberData(nameof(CelsiusToFahrenheitData))]
        public void FromCelsiustoFahrenheit(int degreesInCelsius, int degreesInFahrenheit)
        {
            Assert.Equal(
                expected: degreesInFahrenheit,
                actual: UnitConvert.FromCelsiusToFahrenheit(degreesInCelsius)
            );
        }

        [Theory]
        [MemberData(nameof(CelsiusToFahrenheitData))]
        public void FromFahrenheitToCelsiusTest(int degreesInCelsius, int degreesInFahrenheit)
        {
            Assert.Equal(
                expected: degreesInCelsius,
                actual: UnitConvert.FromFahrenheitToCelsius(degreesInFahrenheit)
            );
        }
    }
}
{'fraction_non_alphanumeric': 0.11629153269024652, 'fraction_numerical': 0.052161486245087534, 'mean_word_length': 1.4697838553153948, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6883493', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1492, 'n_words': 416}