示例#1
0
        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.Append($"{nameof(Description)}: {Description}\n");
            if (!string.IsNullOrEmpty(Link))
            {
                builder.Append($"{nameof(Link)}: {Link}\n");
            }

            foreach (var include in Includes.Select((value, i) => new { i, value }))
            {
                builder.Append($"{nameof(Includes)}[{include.i}]: {include.value}\n");
            }

            foreach (var delete in Deletes.Select((value, i) => new { i, value }))
            {
                builder.Append($"{nameof(Deletes)}[{delete.i}]: {delete.value}\n");
            }

            foreach (var arg in Arguments.Select((value, i) => new { i, value }))
            {
                builder.Append($"{nameof(Arguments)}[{arg.i}]: {arg.value}\n");
            }

            return(builder.ToString());
        }
示例#2
0
        private List <string> Parse(string[] args)
        {
            var unknown = _options.Parse(args);

            if (Browsers.Count == 0)
            {
                Browsers.AddRange(DefaultBrowsers);
            }
            if (Reporters.Count == 0)
            {
                foreach (var reporter in DefaultReporter)
                {
                    AddReporter(reporter);
                }
            }

            if (Includes.Count == 0)
            {
                MethodFilter = new DefaultTestMethodFilter(this.IncludeNotDoneTests, this.VariantUnderTest, this.AutomatedRunId);
            }
            else
            {
                //TODO include variants
                var groups = Includes.Select(include => new GroupFilter(include, this.IncludeNotDoneTests, this.VariantUnderTest, this.AutomatedRunId)).Cast <IFilter <MethodInfo> >().ToList();
                MethodFilter = new Or <MethodInfo>(groups);
            }
            return(unknown);
        }
示例#3
0
文件: Class.cs 项目: Creepsky/Nexus
 public override object Clone()
 {
     return(new Class(new string(Name),
                      (TemplateList)TemplateList?.CloneDeep(),
                      Variables.Select(i => (Variable)i.CloneDeep()).ToList(),
                      CppBlocks.Select(i => (CppBlockStatement)i.CloneDeep()).ToList(),
                      Includes.Select(i => (Include)i.CloneDeep()).ToList()));
 }
示例#4
0
        /// <inheritdoc />
        public override string ToString()
        {
            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("{");
            stringBuilder.AppendLine($"\t\"Includes\": [ {string.Join(",", Includes.Select(x => $"\"{x}\""))} ], ");
            stringBuilder.AppendLine($"\t\"Excludes\": [ {string.Join(",", Excludes.Select(x => $"\"{x}\""))} ], ");
            stringBuilder.AppendLine($"\t\"CaseSensitive\": {CaseSensitive}, ");
            stringBuilder.AppendLine($"\t\"BasePath\": {BasePath.FullPath}");
            stringBuilder.AppendLine("}");
            return(stringBuilder.ToString());
        }
示例#5
0
 /// <summary>
 /// Creates a snapshot of the query results
 /// </summary>
 public QueryResult CreateSnapshot()
 {
     return(new QueryResult
     {
         Results = new List <RavenJObject>(Results.Select(x => x.CreateSnapshot())),
         Includes = new List <RavenJObject>(Includes.Select(x => x.CreateSnapshot())),
         IndexEtag = IndexEtag,
         IndexName = IndexName,
         IndexTimestamp = IndexTimestamp,
         IsStale = IsStale,
         SkippedResults = SkippedResults,
         TotalResults = TotalResults,
     });
 }
        public TreeTextRange Translate(DocumentRange documentRange)
        {
            if (!documentRange.IsValid())
            {
                return(TreeTextRange.InvalidRange);
            }
            if (!SourceFile.IsValid())
            {
                return(TreeTextRange.InvalidRange);
            }
            if (!FileLikeNode.IsValid())
            {
                return(TreeTextRange.InvalidRange);
            }

            if (documentRange.Document != SourceFile.Document)
            {
                // That document might appear among the includes
                var rangeFromIncludes = Includes
                                        .Select(include => include.DocumentRangeTranslator.Translate(documentRange))
                                        .Where(textRange => textRange.IsValid())
                                        // Allow FirstOrDefault to return null
                                        .Select <TreeTextRange, TreeTextRange?>(it => it)
                                        .FirstOrDefault();
                return(rangeFromIncludes ?? TreeTextRange.InvalidRange);
            }

            // The range is in the same document as the source file we are responsible for,
            // so we have no choice but to handle the request ourselves
            (int documentStartOffset, int documentEndOffset) = documentRange.TextRange;
            var rootStartOffset = FileLikeNode.GetTreeStartOffset();

            // No includes, tree and document are matching
            if (!Includes.Any())
            {
                return(new TreeTextRange(rootStartOffset + documentStartOffset, rootStartOffset + documentEndOffset));
            }

            var treeStartOffset = Translate(documentStartOffset);

            if (!treeStartOffset.IsValid())
            {
                return(TreeTextRange.InvalidRange);
            }
            return(TreeTextRange.FromLength(treeStartOffset, documentRange.Length));
        }
示例#7
0
 public void BuildIncludesDef(NotifyCollectionChangedEventArgs args)
 {
     _pack.Includes = Includes.Select(x => ((IncludeModel)x)._include).ToList();
 }
示例#8
0
        public string GetRequestUri()
        {
            if (string.IsNullOrEmpty(IndexName))
            {
                throw new InvalidOperationException("Index name cannot be null or empty");
            }

            var uri = new StringBuilder();

            string pathSuffix = string.Empty;

            if (MapGroupFields.Count > 0)
            {
                var separator = string.Empty;
                foreach (string key in MapGroupFields.Keys)
                {
                    pathSuffix = pathSuffix + separator + key + '=' + MapGroupFields[key];
                    separator  = ";";
                }
            }
            else
            {
                if (DocumentId == null)
                {
                    throw new ArgumentNullException("DocumentId", "DocumentId cannot be null");
                }

                pathSuffix = DocumentId;
            }

            uri.AppendFormat("/morelikethis/?index={0}&docid={1}&", Uri.EscapeUriString(IndexName), Uri.EscapeDataString(pathSuffix));
            if (Fields != null)
            {
                foreach (var field in Fields)
                {
                    uri.AppendFormat("fields={0}&", field);
                }
            }
            if (Boost != null && Boost != DefaultBoost)
            {
                uri.Append("boost=true&");
            }
            if (BoostFactor != null && BoostFactor != DefaultBoostFactor)
            {
                uri.AppendFormat("boostFactor={0}&", BoostFactor);
            }
            if (MaximumQueryTerms != null && MaximumQueryTerms != DefaultMaximumQueryTerms)
            {
                uri.AppendFormat("maxQueryTerms={0}&", MaximumQueryTerms);
            }
            if (MaximumNumberOfTokensParsed != null && MaximumNumberOfTokensParsed != DefaultMaximumNumberOfTokensParsed)
            {
                uri.AppendFormat("maxNumTokens={0}&", MaximumNumberOfTokensParsed);
            }
            if (MaximumWordLength != null && MaximumWordLength != DefaultMaximumWordLength)
            {
                uri.AppendFormat("maxWordLen={0}&", MaximumWordLength);
            }
            if (MinimumDocumentFrequency != null && MinimumDocumentFrequency != DefaultMinimumDocumentFrequency)
            {
                uri.AppendFormat("minDocFreq={0}&", MinimumDocumentFrequency);
            }
            if (MaximumDocumentFrequency != null && MaximumDocumentFrequency != DefaultMaximumDocumentFrequency)
            {
                uri.AppendFormat("maxDocFreq={0}&", MaximumDocumentFrequency);
            }
            if (MaximumDocumentFrequencyPercentage != null)
            {
                uri.AppendFormat("maxDocFreqPct={0}&", MaximumDocumentFrequencyPercentage);
            }
            if (MinimumTermFrequency != null && MinimumTermFrequency != DefaultMinimumTermFrequency)
            {
                uri.AppendFormat("minTermFreq={0}&", MinimumTermFrequency);
            }
            if (MinimumWordLength != null && MinimumWordLength != DefaultMinimumWordLength)
            {
                uri.AppendFormat("minWordLen={0}&", MinimumWordLength);
            }
            if (StopWordsDocumentId != null)
            {
                uri.AppendFormat("stopWords={0}&", StopWordsDocumentId);
            }
            if (string.IsNullOrEmpty(ResultsTransformer) == false)
            {
                uri.AppendFormat("&resultsTransformer={0}", Uri.EscapeDataString(ResultsTransformer));
            }

            if (TransformerParameters != null)
            {
                foreach (var input in TransformerParameters)
                {
                    uri.AppendFormat("&tp-{0}={1}", input.Key, input.Value);
                }
            }

            if (Includes != null && Includes.Length > 0)
            {
                uri.Append(string.Join("&", Includes.Select(x => "include=" + x).ToArray()));
            }

            return(uri.ToString());
        }
示例#9
0
            public BaseFloorSelector Unwrap()
            {
                IValueGenerator defaultHeight = DefaultHeight == null ? new NormallyDistributedValue(2.5f, 3, 3.5f, 0.2f) : IValueGeneratorContainer.FromObject(DefaultHeight);

                return(new FloorRangeSpec(Includes.Select(a => a.Unwrap(defaultHeight)).ToArray()));
            }
 /// <inheritdoc/>
 public override string ToString()
 {
     return(Includes != null && Includes.Any() ? "include=" + string.Join(",", Includes.Select(p => p.ToString())) : string.Empty);
 }