Exemplo 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 = _storeProvider.Store.OpenAsyncSession())
            {
                var dbFeature = await session.Query <Features_ByTitleProductAndGroup.QueryModel, Features_ByTitleProductAndGroup>()
                                .Where(feature => feature.Product == productName &&
                                       feature.Group == groupName &&
                                       feature.Title == title &&
                                       feature.Version == version)
                                .OfType <DbFeature>()
                                .SingleOrDefaultAsync();

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

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

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

                return(result);
            }
        }
Exemplo n.º 2
0
        public async Task <DisplayableFeature> GetAsync(string branchName, string groupName, string title)
        {
            // Get the feature from storage
            // NOTE: Using the branchName as product name because of backwards compatability
            DisplayableFeature feature = await _featureManager.GetFeatureAsync(branchName, groupName, title, UNKNOWN_VERSION);

            return(feature);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
            }
        }