public void CopiesTheScoreToTheResult()
        {
            var classUnderTest = new DetectedLanguageBuilder(CreateLanguageIsoCodeMappings());
            var languageInfo = new LanguageInfo("", "eng", "", "");
            double score = new Random().NextDouble();
            DetectedLangage result = classUnderTest.BuildFromResult(languageInfo, score);

            Assert.That(result.MatchScore, Is.EqualTo(score));
        }
        public void WhenNoMatchingMappingReturnsOnlyValuesInLanguageInfo()
        {
            var classUnderTest = new DetectedLanguageBuilder(new StubIso639CodeMappingLoader());
            var languageInfo = new LanguageInfo("", "eng", "", "");
            double score = new Random().NextDouble();
            DetectedLangage result = classUnderTest.BuildFromResult(languageInfo, score);

            Assert.That(result.MatchScore, Is.EqualTo(score));
            Assert.That(result.Iso6393LanguageCode, Is.EqualTo("eng"));
        }
        public void GivenListOfIso639VariantMappingsCorrectlyBuilDetectedLanauge    ()
        {
            var classUnderTest = new DetectedLanguageBuilder(CreateLanguageIsoCodeMappings());
            var languageInfo = new LanguageInfo("", "eng", "", "");
            DetectedLangage result = classUnderTest.BuildFromResult(languageInfo, 0);

            Assert.That(result.Iso6391LanguageCode, Is.EqualTo("en"));
            Assert.That(result.EnglishName, Is.EqualTo("English"));
            Assert.That(result.NativeName, Is.EqualTo("English"));
        }
        public void CopiesLangugeInfoValuesToDetectedLanguageResponse()
        {
            var classUnderTest = new DetectedLanguageBuilder(CreateLanguageIsoCodeMappings());
            var iso6393 = "eng";
            var languageInfo = new LanguageInfo("", iso6393, "", "");
            const double score = 0;
            DetectedLangage result = classUnderTest.BuildFromResult(languageInfo, score);

            Assert.That(result.Iso6393LanguageCode, Is.EqualTo(iso6393));
        }