private bool ScenarioOutlineExampleIsMatch(assembliesAssemblyCollectionTest exampleElement, Regex signature)
        {
            // split scenario outline title to name + parameters
            var nameAndArgumentsSplitter = new Regex(@"^(?<name>(.*))(\(.*\))$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
            var groups       = nameAndArgumentsSplitter.Match(exampleElement.name).Groups;
            var scenarioName = groups["name"].Success ? groups["name"].Value : exampleElement.name;
            var scenariotNameWithNoSpacesAndSpecialCharacters = exampleElement.name.Replace(scenarioName, exampleElement.method);

            var esc = Regex.Escape("\"");
            var escapedScenariotNameWithNoSpacesAndSpecialCharacters = scenariotNameWithNoSpacesAndSpecialCharacters.Replace(@"\\""", "\"").Replace(@"\""", esc);
            var escapedExampleElementName = exampleElement.name.Replace(@"\\""", "\"").Replace(@"\""", esc);
            var escapedSignature          = signature.ToString().Replace(@"\""", esc);

            return(Regex.IsMatch(escapedExampleElementName, escapedSignature, RegexOptions.IgnoreCase) || Regex.IsMatch(escapedScenariotNameWithNoSpacesAndSpecialCharacters, escapedSignature, RegexOptions.IgnoreCase));
        }
Exemplo n.º 2
0
        private TestResult GetResultFromElement(assembliesAssemblyCollectionTest element)
        {
            TestResult result;

            switch (element.result.ToLowerInvariant())
            {
            case "pass":
                result = TestResult.Passed;
                break;

            case "fail":
                result = TestResult.Failed;
                break;

            case "skip":
            default:
                result = TestResult.Inconclusive;
                break;
            }

            return(result);
        }
Exemplo n.º 3
0
 private static bool HasTraitWithValue(assembliesAssemblyCollectionTest test, string trait, string value)
 {
     return(test.traits != null && test.traits.Any(t => t.name == trait && t.value == value));
 }
Exemplo n.º 4
0
 private static bool HasFeatureTitleTrait(assembliesAssemblyCollectionTest test, string featureTitle)
 {
     return(HasTraitWithValue(test, "FeatureTitle", featureTitle));
 }
Exemplo n.º 5
0
 private static bool HasDescriptionTrait(assembliesAssemblyCollectionTest test, string description)
 {
     return(HasTraitWithValue(test, "Description", description));
 }