/// <summary>
        /// Gets the language.
        /// </summary>
        /// <param name="fileContent">Content of the file.</param>
        /// <returns>
        /// An object that supports the <see cref="ILanguageInfo" /> abstraction.
        /// </returns>
        public ILanguageInfo TryParse(string fileContent)
        {
            var name      = this.specifiedLanguage.Name;
            var langMatch = LanguagePattern.Match(fileContent);

            if (langMatch.Success)
            {
                name = langMatch.Groups["lang"].Value;
            }

            return(SupportedLanguages.GetSupportedLanguage(name));
        }
Ejemplo n.º 2
0
 public void ShouldNotSupportGerman()
 {
     Should.Throw <Gherkin.GherkinException>(() => SupportedLanguages.GetSupportedLanguage("de"));
 }
Ejemplo n.º 3
0
        public void ShouldSupportFrench()
        {
            var item = SupportedLanguages.GetSupportedLanguage("fr");

            item.Should().NotBeNull();
        }
Ejemplo n.º 4
0
        public void ShouldSupportEnglishUk()
        {
            var item = SupportedLanguages.GetSupportedLanguage("en-UK");

            item.Should().NotBeNull();
        }
 /// <summary>
 /// Gets the language information for the specified code.
 /// </summary>
 /// <param name="code">The code.</param>
 /// <returns>An object that supports the <see cref="ILanguageInfo"/> abstraction.</returns>
 public static ILanguageInfo For(string code)
 {
     return(SupportedLanguages.GetSupportedLanguage(code));
 }
 /// <summary>
 /// Returns an enumerator that iterates through the collection.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.Collections.Generic.IEnumerator`1" /> that can be used to iterate through the collection.
 /// </returns>
 public IEnumerator <IGherkinVocabulary> GetEnumerator()
 {
     return(SupportedLanguages.All().Select(x => new VocabularyAdapter(x)).GetEnumerator());
 }