/// <summary>
 /// Истина если параметр локали соответствует языку-источнику в направлении перевода.
 /// </summary>
 /// <param name="comparedLocaleName"></param>
 /// <returns></returns>
 public bool IsFrom(DetectInputLanguage.Language lang)
 {
     bool result = (lang == DetectInputLanguage.Language.English && this.LanguageFrom.NameShort == "en");
     if (!result)
         result = (lang == DetectInputLanguage.Language.Russian && this.LanguageFrom.NameShort == "ru");
     return result;
 }
        public void TestMust_DetectUnknown(string inputString)
        {
            //arrange

            //act
            DetectInputLanguage detect = new DetectInputLanguage(inputString);
            DetectInputLanguage.Language result = detect.Detect();

            //assert
            Assert.IsTrue(result == DetectInputLanguage.Language.Unknown);
        }
        private async void startRequestWithValidation(string originalText)
        {
            preparedTextForRequest = prepareTextForRequest(originalText);
            if (!string.IsNullOrEmpty(preparedTextForRequest))
            {
                DetectInputLanguage detect = new DetectInputLanguage(originalText);
                DetectInputLanguage.Language result = detect.Detect();
                if ((result!=DetectInputLanguage.Language.Unknown) && !direction.IsFrom(result))
                {
                    direction.Invert();
                    updateDestinationCaption();

                };
                await RequestReference(preparedTextForRequest);
            }
        }