public void OnFeatureStart_DefersToInnerSynchronousTestRunner()
        {
            var featureInfo = new FeatureInfo(CultureInfoHelper.GetCultureInfo("en-us"), "title", "description");

            asyncTestRunner.OnFeatureStart(featureInfo);

            testExecutionEngineStub.Verify(m => m.OnFeatureStart(featureInfo));
        }
示例#2
0
        private static KeywordTranslation LoadTranslation(CultureInfo language)
        {
            var assembly  = typeof(LanguageHelper).Assembly;
            var docStream = assembly.GetManifestResourceStream("TechTalk.SpecFlow.Languages.xml");

            if (docStream == null)
            {
                throw new InvalidOperationException("Language resource not found.");
            }

            XDocument languageDoc;

            using (var reader = new StreamReader(docStream))
            {
                languageDoc = XDocument.Load(reader);
            }

            XElement langElm = GetBestFitLanguageElement(languageDoc, language);

            KeywordTranslation result = new KeywordTranslation();

            if (language.IsNeutralCulture)
            {
                var defaultSpecificCultureAttr = langElm.Attribute(XName.Get("defaultSpecificCulture", ""));
                if (defaultSpecificCultureAttr == null)
                {
                    result.DefaultSpecificCulture = CultureInfoHelper.GetCultureInfo("en-US");
                }
                else
                {
                    result.DefaultSpecificCulture = CultureInfoHelper.GetCultureInfo(defaultSpecificCultureAttr.Value);
                }
            }
            else
            {
                result.DefaultSpecificCulture = language;
            }

            foreach (StepDefinitionKeyword keyword in EnumHelper.GetValues(typeof(StepDefinitionKeyword)))
            {
                //NOTE: we only load the first translation of each keyword
                XElement keywordElm = langElm.Element(keyword.ToString());
                Debug.Assert(keywordElm != null);
                result[keyword] = keywordElm.Value;
            }

            return(result);
        }
示例#3
0
        public RuntimeConfiguration()
        {
            ToolLanguage   = CultureInfoHelper.GetCultureInfo(ConfigDefaults.FeatureLanguage);
            BindingCulture = null;

            RuntimeUnitTestProvider = ConfigDefaults.UnitTestProviderName;

            DetectAmbiguousMatches       = ConfigDefaults.DetectAmbiguousMatches;
            StopAtFirstError             = ConfigDefaults.StopAtFirstError;
            MissingOrPendingStepsOutcome = ConfigDefaults.MissingOrPendingStepsOutcome;

            TraceListenerType    = typeof(DefaultListener);
            TraceSuccessfulSteps = ConfigDefaults.TraceSuccessfulSteps;
            TraceTimings         = ConfigDefaults.TraceTimings;
            MinTracedDuration    = TimeSpan.Parse(ConfigDefaults.MinTracedDuration);
        }
示例#4
0
        public RuntimeConfiguration()
        {
            FeatureLanguage = CultureInfoHelper.GetCultureInfo(ConfigDefaults.FeatureLanguage);
            ToolLanguage    = CultureInfoHelper.GetCultureInfo(ConfigDefaults.FeatureLanguage);
            BindingCulture  = null;

            RuntimeUnitTestProvider = ConfigDefaults.UnitTestProviderName;

            DetectAmbiguousMatches       = ConfigDefaults.DetectAmbiguousMatches;
            StopAtFirstError             = ConfigDefaults.StopAtFirstError;
            MissingOrPendingStepsOutcome = ConfigDefaults.MissingOrPendingStepsOutcome;

            TraceSuccessfulSteps        = ConfigDefaults.TraceSuccessfulSteps;
            TraceTimings                = ConfigDefaults.TraceTimings;
            MinTracedDuration           = TimeSpan.Parse(ConfigDefaults.MinTracedDuration);
            StepDefinitionSkeletonStyle = ConfigDefaults.StepDefinitionSkeletonStyle;

            AdditionalStepAssemblies = new List <string>();
        }
示例#5
0
        public StepContext(FeatureInfo featureInfo, ScenarioInfo scenarioInfo)
        {
            Language = featureInfo == null?CultureInfoHelper.GetCultureInfo(ConfigDefaults.FeatureLanguage) : featureInfo.Language;

            FeatureTitle  = featureInfo == null ? null : featureInfo.Title;
            ScenarioTitle = scenarioInfo == null ? null : scenarioInfo.Title;

            var tags = Enumerable.Empty <string>();

            if (featureInfo != null && featureInfo.Tags != null)
            {
                tags = tags.Concat(featureInfo.Tags);
            }
            if (scenarioInfo != null && scenarioInfo.Tags != null)
            {
                tags = tags.Concat(scenarioInfo.Tags).Distinct();
            }
            Tags = tags;
        }
示例#6
0
        private static CultureInfo GetCultureInfoFromQueryString(string key, CultureInfo defaultValue)
        {
            string value;

            return(QueryString.TryGetValue(key, out value) ? CultureInfoHelper.GetCultureInfo(value) : defaultValue);
        }