示例#1
0
        /// <summary>
        /// Translate this instance to json
        /// </summary>
        public RavenJObject ToJson()
        {
            var jObject = new RavenJObject
            {
                { "Type", new RavenJValue(Type.ToString()) },
                { "Value", Value },
                { "Name", new RavenJValue(Name) }
            };

            if (Position != null)
            {
                jObject.Add("Position", new RavenJValue(Position.Value));
            }
            if (Nested != null)
            {
                jObject.Add("Nested", new RavenJArray(Nested.Select(x => x.ToJson())));
            }
            if (AllPositions != null)
            {
                jObject.Add("AllPositions", new RavenJValue(AllPositions.Value));
            }
            if (PrevVal != null)
            {
                jObject.Add("PrevVal", PrevVal);
            }
            return(jObject);
        }
示例#2
0
        public JObject ToJson()
        {
            var jObject = new JObject(
                new JProperty("Type", new JValue(Type)),
                new JProperty("Value", Value),
                new JProperty("Name", new JValue(Name)),
                new JProperty("Position", Position == null ? null : new JValue(Position.Value)),
                new JProperty("Nested", Nested == null ? null : new JArray(Nested.Select(x => x.ToJson())))
                );

            if (PrevVal != null)
            {
                jObject.Add(new JProperty("PrevVal", PrevVal));
            }
            return(jObject);
        }
示例#3
0
 internal new TestResultsHolder Clone()
 {
     return(new TestResultsHolder
     {
         Id = Id,
         ParentId = ParentId,
         IsSuite = IsSuite,
         Name = Name,
         Skipped = Skipped,
         Failure = Failure,
         Duration = Duration,
         Failures = Failures.ToList(),
         Nested = new List <SuiteOrTest>(Nested.Select(n => n.Clone())),
         Logs = Logs.ToList(),
         UserAgent = UserAgent,
         Running = Running,
         TestsFailed = TestsFailed,
         TestsFinished = TestsFinished,
         TestsSkipped = TestsSkipped,
         TotalTests = TotalTests
     });
 }
示例#4
0
文件: 544.cs 项目: moozzyk/LeetCode
 public override string ToString()
 {
     return("(" + string.Join(",", Nested.Select(i => Nested[0].Nested != null ? i.ToString() : i.Singleton.ToString())) + ")");
 }