Ejemplo n.º 1
0
        /// <summary>
        /// Gets the feature that matches the provided criteria.
        /// </summary>
        /// <param name="productName">The name of the product under which the feature is positioned.</param>
        /// <param name="groupName">The name of the group under which the feature is positioned.</param>
        /// <param name="title">The title of the feature.</param>
        /// <param name="version">Version of the feature to retrieve.</param>
        /// <returns>
        /// A <see cref="DisplayableFeature"/> instance describing the requested feature; 
        /// or <c>null</c> if the feature cannot be found.
        /// </returns>
        public async Task<DisplayableFeature> GetFeatureAsync(string productName, string groupName, string title, string version)
        {
            using (var session = Database.DocumentStore.OpenAsyncSession())
            {
                var dbFeature = await session.LoadAsync<DbFeature>(DbFeatureExtensions.GetIdentifier(productName, groupName, title, version));

                if (dbFeature == null)
                {
                    return null;
                }

                var result = new DisplayableFeature(dbFeature);
                result.TestResult = dbFeature.TestResult;
                result.Version = dbFeature.Version;

                // Process the server tags
                var processor = new FeatureProcessor();
                processor.Process(result);

                return result;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Processes the server tags on the provided feature.
        /// </summary>
        /// <param name="feature">The <see cref="DisplayableFeature"/> that should be processed.</param>
        public void Process(DisplayableFeature feature)
        {
            // Get the server tags
            IEnumerable<string> serverTags = GetServerTags(feature.Tags);

            foreach (var tag in serverTags)
            {
                string[] tagParts = tag.Split(new[] { ":" }, 2, StringSplitOptions.RemoveEmptyEntries);

                    if (_notImplementedTags.Contains(tagParts[0]))
                    {
                        feature.Properties |= FeatureProperties.NotImplemented;
                    }
                    if (_ignoreTags.Contains(tagParts[0]))
                    {
                        feature.Properties |= FeatureProperties.Ignore;
                    }
            }

            // Remove all server tags
            RemoveServerTags(feature);
        }