コード例 #1
0
        public static FeatureMatch CreateFeatureMatch(this DbFeature feature, string searchTerm)
        {
            var match = new FeatureMatch()
            {
                FeatureName          = feature.Title,
                ShortenedDescription = feature.Description?.Substring(0, Math.Min(feature.Description.Length, 100)) + "...",
                ProductName          = feature.Product,
                GroupName            = feature.Group,
                Version = feature.Versions.OrderBy(v => v, new SemanticVersionComparer()).FirstOrDefault(),
                Tags    = feature.Tags.ToList()
            };

            string[] searchTerms = searchTerm.Split(" ", StringSplitOptions.RemoveEmptyEntries);

            string matchingText = FindMatchingText(feature.Description, searchTerms);

            if (String.IsNullOrEmpty(matchingText) && feature.Background != null)
            {
                matchingText = FindMatchingText(feature.Background.ToString(), searchTerms);
            }
            var enumerator = feature.Scenarios.GetEnumerator();

            while (String.IsNullOrEmpty(matchingText) && enumerator.MoveNext())
            {
                matchingText = FindMatchingText(enumerator.Current.ToString(), searchTerms);
            }

            match.MatchingText = matchingText;

            return(match);
        }
コード例 #2
0
ファイル: DbFeatureExtensions.cs プロジェクト: tonksol/Augurk
 public static string GetIdentifier(this DbFeature feature)
 {
     return(GetIdentifier(feature.Product, feature.Group, feature.Title, feature.Version));
 }
コード例 #3
0
 public static string GetIdentifier(this DbFeature feature)
 {
     // Calculate the hash if it doesn't have it, it might still be an old feature
     return(GetIdentifier(feature.Product, feature.Group, feature.Title, feature.Hash ?? feature.CalculateHash()));
 }
コード例 #4
0
        /// <summary>
        /// Processes the provided <paramref name="feature"/> after it has been uploaded and stores the results of the analysis.
        /// </summary>
        /// <param name="productName">Name of the product containing the feature.</param>
        /// <param name="version">Version of the porudct containing the feature.</param>
        /// <param name="feature">A <see cref="DbFeature"/> representing the feature to process.</param>
        public async Task AnalyzeAndPeristResultsAsync(string productName, string version, DbFeature feature)
        {
            // Collect all analysisreports for the provided product/version combination
            IEnumerable <AnalysisReport> reports = _analysisReportManager.GetAnalysisReportsByProductAndVersionAsync(productName, version);

            if (reports.Any())
            {
                // Analyze the features based on the provided report
                await AnalyzeAndPersistAsync(productName, version, new[] { feature }, reports);
            }
        }