<commit_before>﻿using System.Threading.Tasks;
using MarkEmbling.PostcodesIO.Results;
using NUnit.Framework;
using System.Collections.Generic;

namespace MarkEmbling.PostcodesIO.Tests.Integration {
    [TestFixture, Explicit("Hits live Postcodes.io API")]
    public class LookupTests {
        private PostcodesIOClient _client;

        [SetUp]
        public void Setup() {
            _client = new PostcodesIOClient();
        }

        [Test]
        public void Lookup_returns_populated_response()
        {
            var result = _client.Lookup("GU1 1AA");

            TestLookup_returns_populated_responseResult(result);
        }

        [Test]
        public void OutwardCode_Lookup_returns_populated_response()
        {
            var result = _client.OutwardCodeLookup("IP3");

            TestOutwardCode_Lookup_returns_populated_responseResult(result);
        }

        [Test]
        public async Task Lookup_returns_populated_response_async()
        {
            var result = await _client.LookupAsync("GU1 1AA");

            TestLookup_returns_populated_responseResult(result);
        }

        private static void TestLookup_returns_populated_responseResult(PostcodeResult result)
        {
            Assert.AreEqual("GU1 1AA", result.Postcode);
            Assert.AreEqual(1, result.Quality);
            Assert.AreEqual(499049, result.Eastings);
            Assert.AreEqual(150522, result.Northings);
            Assert.AreEqual("England", result.Country);
            Assert.AreEqual("South East Coast", result.NHSHealthAuthority);
            Assert.AreEqual(-0.582332541160269, result.Longitude);
            Assert.AreEqual(51.2452835933475, result.Latitude);
            Assert.AreEqual("Guildford", result.ParliamentaryConstituency);
            Assert.AreEqual("South East", result.EuropeanElectoralRegion);
            Assert.AreEqual("Surrey", result.PrimaryCareTrust);
            Assert.AreEqual("South East", result.Region);
            Assert.AreEqual("Guildford 015A", result.LSOA);
            Assert.AreEqual("Guildford 015", result.MSOA);
            Assert.AreEqual("West Surrey", result.NUTS);
            Assert.AreEqual("1AA", result.InCode);
            Assert.AreEqual("GU1", result.OutCode);
            Assert.AreEqual("Guildford", result.AdminDistrict);
            Assert.AreEqual("Guildford, unparished area", result.Parish);
            Assert.AreEqual("Surrey", result.AdminCounty);
            Assert.AreEqual("Friary and St Nicolas", result.AdminWard);
            Assert.AreEqual("NHS Guildford and Waverley", result.CCG);
            Assert.NotNull(result.Codes);
        }

        private static void TestOutwardCode_Lookup_returns_populated_responseResult(OutwardCodeResult result)
        {
            Assert.AreEqual("IP3", result.Outcode);
            Assert.AreEqual(1.18793994032433, result.Longitude);
            Assert.AreEqual(52.0412229520819, result.Latitude);
            Assert.AreEqual(242888, result.Northings);
            Assert.AreEqual(618728, result.Eastings);
            Assert.AreEqual(new List<string>() { "Suffolk Coastal", "Ipswich" }, result.AdminDistrict);
            Assert.AreEqual(new List<string>() { "Ipswich, unparished area", "Rushmere St. Andrew", "Purdis Farm" }, result.Parish);
            Assert.AreEqual(new List<string>() { "Suffolk" }, result.AdminCounty);
            Assert.AreEqual(new List<string>() { "Alexandra", "St John's", "Tower", "Bixley", "Holywells", "Priory Heath", "Gainsborough", "Nacton & Purdis Farm" }, result.AdminWard);    
        }

        [Test]
        public void Lookup_returns_populated_codes_property()
        {
            var result = _client.Lookup("GU1 1AA").Codes;

            TestLookup_returns_populated_codes_propertyResult(result);
        }

        [Test]
        public async Task Lookup_returns_populated_codes_property_async()
        {
            var result = (await _client.LookupAsync("GU1 1AA")).Codes;

            TestLookup_returns_populated_codes_propertyResult(result);
        }

        private static void TestLookup_returns_populated_codes_propertyResult(Codes result)
        {
            Assert.AreEqual("E07000209", result.AdminDistrict);
            Assert.AreEqual("E10000030", result.AdminCounty);
            Assert.AreEqual("E05007293", result.AdminWard);
            Assert.AreEqual("E43000138", result.Parish);
            Assert.AreEqual("E38000214", result.CCG);
        }
    }
}<commit_msg>Fix data in tests<commit_after>﻿using System.Threading.Tasks;
using MarkEmbling.PostcodesIO.Results;
using NUnit.Framework;
using System.Collections.Generic;

namespace MarkEmbling.PostcodesIO.Tests.Integration {
    [TestFixture, Explicit("Hits live Postcodes.io API")]
    public class LookupTests {
        private PostcodesIOClient _client;

        [SetUp]
        public void Setup() {
            _client = new PostcodesIOClient();
        }

        [Test]
        public void Lookup_returns_populated_response()
        {
            var result = _client.Lookup("GU1 1AA");

            TestLookup_returns_populated_responseResult(result);
        }

        [Test]
        public void OutwardCode_Lookup_returns_populated_response()
        {
            var result = _client.OutwardCodeLookup("IP3");

            TestOutwardCode_Lookup_returns_populated_responseResult(result);
        }

        [Test]
        public async Task Lookup_returns_populated_response_async()
        {
            var result = await _client.LookupAsync("GU1 1AA");

            TestLookup_returns_populated_responseResult(result);
        }

        private static void TestLookup_returns_populated_responseResult(PostcodeResult result)
        {
            Assert.AreEqual("GU1 1AA", result.Postcode);
            Assert.AreEqual(1, result.Quality);
            Assert.AreEqual(499049, result.Eastings);
            Assert.AreEqual(150522, result.Northings);
            Assert.AreEqual("England", result.Country);
            Assert.AreEqual("South East Coast", result.NHSHealthAuthority);
            Assert.AreEqual(-0.582332, result.Longitude);
            Assert.AreEqual(51.245283, result.Latitude);
            Assert.AreEqual("Guildford", result.ParliamentaryConstituency);
            Assert.AreEqual("South East", result.EuropeanElectoralRegion);
            Assert.AreEqual("Surrey", result.PrimaryCareTrust);
            Assert.AreEqual("South East", result.Region);
            Assert.AreEqual("Guildford 015A", result.LSOA);
            Assert.AreEqual("Guildford 015", result.MSOA);
            Assert.AreEqual("West Surrey", result.NUTS);
            Assert.AreEqual("1AA", result.InCode);
            Assert.AreEqual("GU1", result.OutCode);
            Assert.AreEqual("Guildford", result.AdminDistrict);
            Assert.AreEqual("Guildford, unparished area", result.Parish);
            Assert.AreEqual("Surrey", result.AdminCounty);
            Assert.AreEqual("Friary and St Nicolas", result.AdminWard);
            Assert.AreEqual("NHS Guildford and Waverley", result.CCG);
            Assert.NotNull(result.Codes);
        }

        private static void TestOutwardCode_Lookup_returns_populated_responseResult(OutwardCodeResult result)
        {
            Assert.AreEqual("IP3", result.Outcode);
            Assert.AreEqual(1.18785462894737, result.Longitude);
            Assert.AreEqual(52.0414095157894, result.Latitude);
            Assert.AreEqual(242908, result.Northings);
            Assert.AreEqual(618721, result.Eastings);
            Assert.AreEqual(new List<string>() { "Suffolk Coastal", "Ipswich" }, result.AdminDistrict);
            Assert.AreEqual(new List<string>() { "Ipswich, unparished area", "Rushmere St. Andrew", "Purdis Farm" }, result.Parish);
            Assert.AreEqual(new List<string>() { "Suffolk" }, result.AdminCounty);
            Assert.AreEqual(new List<string>() { "Bixley", "Gainsborough", "Holywells", "Nacton & Purdis Farm", "Alexandra", "<NAME>", "Tower", "<NAME>" }, result.AdminWard);    
        }

        [Test]
        public void Lookup_returns_populated_codes_property()
        {
            var result = _client.Lookup("GU1 1AA").Codes;

            TestLookup_returns_populated_codes_propertyResult(result);
        }

        [Test]
        public async Task Lookup_returns_populated_codes_property_async()
        {
            var result = (await _client.LookupAsync("GU1 1AA")).Codes;

            TestLookup_returns_populated_codes_propertyResult(result);
        }

        private static void TestLookup_returns_populated_codes_propertyResult(Codes result)
        {
            Assert.AreEqual("E07000209", result.AdminDistrict);
            Assert.AreEqual("E10000030", result.AdminCounty);
            Assert.AreEqual("E05007293", result.AdminWard);
            Assert.AreEqual("E43000138", result.Parish);
            Assert.AreEqual("E38000214", result.CCG);
        }
    }
}
{'fraction_non_alphanumeric': 0.106763555058692, 'fraction_numerical': 0.030855226383454445, 'mean_word_length': 2.684514003294893, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '980351', 'n_tokens_mistral': 2711, 'n_tokens_neox': 2490, 'n_words': 417}