lhAutoWrap() { wrapGroupDic = new Dictionary <string, AssemblyGroup>(); if (File.Exists(configFilePath)) { var jsonObject = lhJson.Parse(File.ReadAllText(configFilePath)) as JsonObject; var jsonArray = new JsonArray(); jsonArray.AddRange(jsonObject["wrappedCustomTypeList"].AsList()); jsonArray.AddRange(jsonObject["wrappedDelegateList"].AsList()); jsonArray.AddRange(jsonObject["dropedTypeList"].AsList()); foreach (var item in jsonArray) { var obj = item as JsonObject; string assemblyName = obj["assemblyName"].AsString(); if (wrapGroupDic.ContainsKey(assemblyName)) { wrapGroupDic[assemblyName].Deserialize(obj); } else { if (CreateGroup(assemblyName)) { wrapGroupDic[assemblyName].Deserialize(obj); } } } } }
private void _Evaluate(JsonValue value, JsonArray results) { switch (value.Type) { case JsonValueType.Object: results.AddRange(value.Object.Values); break; case JsonValueType.Array: results.AddRange(value.Array); break; } }
public void AddRange_NullArray_Works() { JsonArray array = new JsonArray(); array.AddRange(null); Assert.Equal(0, array.Count); }
public void ChannelInitializeWorks() { SetupLists(); var usersData = new List <IDictionary <string, object> > { WithIdentity(First), WithIdentity(Second) }; var users = new JsonArray(); users.AddRange(usersData); MockCommand( WithArgument(Constants.Arguments.Command, Commands.ChannelInitialize), WithArgument(Constants.Arguments.MultipleUsers, users), WithArgument(Constants.Arguments.Channel, ChannelName), WithArgument(Constants.Arguments.Mode, ChannelMode.Both.ToString())); Thread.Sleep(250); characterManager.VerifyAll(); Assert.IsTrue(channelModel.CharacterManager.Characters.Count == 2); Assert.IsTrue(channelModel.Mode == ChannelMode.Both); }
internal JsonObject Serialize() { var jsonObject = new JsonObject { { "type", this.Definition.Name } }; var idJson = this.Id?.Serialize(); if (idJson != null) { jsonObject.Add("id", idJson); } var lnJson = this.SourceLineNumbers?.Serialize(); if (lnJson != null) { jsonObject.Add("ln", lnJson); } var fieldsJson = new JsonArray(this.Fields.Length); foreach (var field in this.Fields) { var fieldJson = field?.Serialize(); fieldsJson.Add(fieldJson); } jsonObject.Add("fields", fieldsJson); if (this.tags is string || this.tags is string[]) { JsonArray tagsJson; if (this.tags is string tag) { tagsJson = new JsonArray(1) { tag }; } else { var array = (string[])this.tags; tagsJson = new JsonArray(array.Length); tagsJson.AddRange(array); } jsonObject.Add("tags", tagsJson); } return(jsonObject); }
internal JsonObject Serialize() { var jsonObject = new JsonObject { { "name", this.Name } }; if (this.Revision > 0) { jsonObject.Add("rev", this.Revision); } var fieldsJson = new JsonArray(this.FieldDefinitions.Length); foreach (var fieldDefinition in this.FieldDefinitions) { var fieldJson = new JsonObject { { "name", fieldDefinition.Name }, }; if (fieldDefinition.Type != IntermediateFieldType.String) { fieldJson.Add("type", fieldDefinition.Type.ToString().ToLowerInvariant()); } fieldsJson.Add(fieldJson); } jsonObject.Add("fields", fieldsJson); if (this.tags is string || this.tags is string[]) { JsonArray tagsJson; if (this.tags is string tag) { tagsJson = new JsonArray(1) { tag }; } else { var array = (string[])this.tags; tagsJson = new JsonArray(array.Length); tagsJson.AddRange(array); } jsonObject.Add("tags", tagsJson); } return(jsonObject); }
public void AddRange_IEnumerable() { JsonArray array = new JsonArray(); JsonValue[] values = new JsonValue[] { null, new JsonPrimitive(true) }; array.AddRange((IEnumerable <JsonValue>)values); Assert.Equal(2, array.Count); Assert.Same(values[0], array[0]); Assert.Same(values[1], array[1]); }
public override bool TrySerializeNonPrimitiveObject(object input, out object output) { if (input is Exception) { var e = input as Exception; var exceptionsJson = this.FlattenExceptions(e).ToList(); var array = new JsonArray(exceptionsJson.Count); array.AddRange(exceptionsJson); output = array; return(true); } return(base.TrySerializeNonPrimitiveObject(input, out output)); }
public void AddRangeParamsTest() { List <JsonValue> items = new List <JsonValue> { AnyInstance.AnyJsonValue1, AnyInstance.AnyJsonValue2, AnyInstance.AnyJsonValue3 }; JsonArray target; target = new JsonArray(); target.AddRange(items[0], items[1], items[2]); ValidateJsonArrayItems(target, items); target = new JsonArray(); target.AddRange(items.ToArray()); ValidateJsonArrayItems(target, items); target.AddRange(); ValidateJsonArrayItems(target, items); items.Add(AnyInstance.DefaultJsonValue); ExceptionTestHelper.ExpectException <ArgumentException>(() => new JsonArray().AddRange(items[items.Count - 1])); ExceptionTestHelper.ExpectException <ArgumentException>(() => new JsonArray().AddRange(items)); }
public override bool TrySerializeNonPrimitiveObject(object input, out object output) { if (input is Exception) { var e = input as Exception; var exceptionsJson = this.FlattenExceptions(e).ToList(); var array = new JsonArray(exceptionsJson.Count); array.AddRange(exceptionsJson); output = array; return true; } return base.TrySerializeNonPrimitiveObject(input, out output); }
public static string CreateJsonWithUnderscores() { var doc = new JsonObject { ["name"] = "John Sheehan", ["start_date"] = new DateTime(2009, 9, 25, 0, 6, 1, DateTimeKind.Utc), ["age"] = 28, ["percent"] = 99.9999m, ["big_number"] = long.MaxValue, ["is_cool"] = false, ["ignore"] = "dummy", ["read_only"] = "dummy", ["url"] = "http://example.com", ["url_path"] = "/foo/bar", ["best_friend"] = new JsonObject { { "name", "The Fonz" }, { "since", 1952 } } }; var friendsArray = new JsonArray(); friendsArray.AddRange( Enumerable.Range(0, 10) .Select( i => new JsonObject { { "name", "Friend" + i }, { "since", DateTime.Now.Year - i } } ) ); doc["friends"] = friendsArray; doc["foes"] = new JsonObject { { "dict1", new JsonObject { { "nickname", "Foe 1" } } }, { "dict2", new JsonObject { { "nickname", "Foe 2" } } } }; return(doc.ToString()); }
public void AddRangeEnumTest() { List <JsonValue> items = new List <JsonValue> { AnyInstance.AnyJsonValue1, AnyInstance.AnyJsonValue2 }; JsonArray target = new JsonArray(); target.AddRange(items); ValidateJsonArrayItems(target, items); ExceptionTestHelper.ExpectException <ArgumentNullException>(() => new JsonArray().AddRange((IEnumerable <JsonValue>)null)); items.Add(AnyInstance.DefaultJsonValue); ExceptionTestHelper.ExpectException <ArgumentException>(() => new JsonArray().AddRange(items)); }
public JsonValue Search(string term) { var array = new JsonArray(); var clients = this.DbContext.Clients .Where(c => c.Company.ToLower().Contains(term.ToLower())) .Select(delegate(Client c) { dynamic json = new JsonObject(); json.label = c.Company; json.id = c.Id; return(json as JsonObject); }); array.AddRange(clients); return(array); }
public override ActionResult GET(System.Net.HttpListenerContext context, string httpActionPath) { JsonArray files = new JsonArray(); files.AddRange( FileRepository.GetFiles() .Select(f => (JsonValue)new JsonObject { { "Name", f.Name }, { "Size", f.Length }, { "Type", f.Extension }, { "Url", "/files/" + f.Name } }) ); var result = new ActionResult(); result.Data = System.Text.Encoding.UTF8.GetBytes(files.ToString()); result.ContentType = "application/json"; return result; }
public JsonValue Search(string term) { var array = new JsonArray(); var clients = this.DbContext.Teams .Where(t => t.Name.ToLower().Contains(term.ToLower())) .Select(delegate(Team t) { dynamic json = new JsonObject(); json.label = t.Name; json.id = t.Id; return(json as JsonObject); }); array.AddRange(clients); return(array); }
private void _Find(JsonValue value, JsonValue root, JsonArray results) { switch (value.Type) { case JsonValueType.Object: foreach (var subValue in value.Object.Values) { _Find(subValue, root, results); } break; case JsonValueType.Array: results.AddRange(_query.Find(value.Array, root)); foreach (var subValue in value.Array) { _Find(subValue, root, results); } break; } }
internal static IList <object> CollapsePagedJson(IDictionary <string, object> paged) { if (null == paged) { return(null); } var list = new List <KeyValuePair <string, object> >(paged); list.Sort((x, y) => x.Key.CompareTo(y.Key)); var result = new JsonArray(); for (int ic = list.Count, i = 0; i < ic; ++i) { var l = list[i].Value as IList <object>; if (null != l) { result.AddRange(l); } } return(result); }
/// <summary> /// Queries Facebook for all active events. /// </summary> /// <returns>Dictionary containing the Event ID as the key, and last Updated Time as the value.</returns> public static IDictionary<Int64, DateTime> GetActiveEventIDsByOwner(List<Owner> owners) { // Combine all owner IDs who do not need tokens HashSet<Int64> noTokenIds = new HashSet<Int64>(owners.Where(o => String.IsNullOrEmpty(o.AccessToken ?? null)).Select(o => o.OwnerID).ToList()); //owners.RemoveAll(o => noTokenIds.Contains(o.OwnerID)); IDictionary<string, string> ownerIds = owners.ToDictionary(o => o.OwnerID.ToString(), o => o.AccessToken ?? null); //ownerIds.Add(string.Join(",", noTokenIds.ToArray()), string.Empty); JsonArray fqlRaveResults = new JsonArray(); foreach (string ownerId in ownerIds.Keys) { // Query Facebook for all active events _fb.AccessToken = String.IsNullOrEmpty(ownerIds[ownerId]) ? _GenericAccessToken : ownerIds[ownerId]; try { // TODO: This is a temp workaround for this FB platform bug: https://developers.facebook.com/bugs/501594683237232 //dynamic fqlJsonResult = _fb.Get("fql", new { q = String.Format("SELECT eid, update_time FROM event WHERE creator IN ({0}) AND eid IN (SELECT eid FROM event_member WHERE uid IN({0})) AND (end_time >= now() OR (end_time = 'null' AND start_time >= now()))", ownerId) }); dynamic fqlJsonResult = _fb.Get("fql", new { q = String.Format("SELECT eid, update_time, creator FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = {0}) AND (end_time >= now() OR (end_time = 'null' AND start_time >= now()))", ownerId) }); fqlRaveResults.AddRange(fqlJsonResult.data); } catch (FacebookOAuthException) { // TODO: Re-enable error notifications //MailHelper.SendErrorMessage(String.Concat("An owner (ID: ", ownerId, ") has an invalid access token. I was unable to query their Events from Facebook.")); } } // Convert results to dictionary and filter duplicates IList<FacebookEventMeta> hotfixResults = new List<FacebookEventMeta>(); foreach (dynamic rid in fqlRaveResults) { hotfixResults.Add(new FacebookEventMeta { EID = rid.eid, Creator = rid.creator, UpdateTime = DateTimeConvertor.FromUnixTime(rid.update_time) }); } hotfixResults = hotfixResults.Distinct().ToList(); hotfixResults = hotfixResults.Where(r => owners.Any(o => o.OwnerID == r.Creator)).ToList(); IDictionary<Int64, DateTime> results = hotfixResults.ToDictionary(r => r.EID, r => r.UpdateTime); return results; }
/// <summary> /// The heuristics scrape uses all the usernames in the database to retrieve their followers and the users they are following. /// These are added to the list of usernames. By repeating this function, the set of usernames grows accordingly with each pass. /// </summary> /// <param name="skip">The amount of usernames to skip (for concurrent scraping)</param> public void HeuristicScrape(int skip, int max = 0) { int handledRecords = skip; List <Author> scrapedUsers = GetAllAuthorsFromDatabase(skip).OrderBy(o => o.Id).ToList(); foreach (Author user in scrapedUsers) { string userName = user.Username; Console.WriteLine($"► {userName}"); JsonArray allConnectedUsers = new JsonArray(); IEnumerable <JsonValue> allFollowers = GetAllFollowersOrFollowingsByUsername(userName, "followers"); IEnumerable <JsonValue> allFollowing = GetAllFollowersOrFollowingsByUsername(userName, "following"); user.AmountFollowers = allFollowers.Count(); user.AmountFollowing = allFollowing.Count(); allConnectedUsers.AddRange(allFollowers.Union(allFollowing)); List <ProjectAuthor> connectedUsersToAuthors = new List <ProjectAuthor>(); foreach (var connectedUser in allConnectedUsers) { if (!connectedUsersToAuthors.Any(o => o.id == Int32.Parse(connectedUser["id"].ToString()))) { connectedUsersToAuthors.Add(Newtonsoft.Json.JsonConvert.DeserializeObject <ProjectAuthor>(connectedUser.ToString())); } } SaveAuthorsToDatabase(ProjectAuthorsToDatabaseEntities(connectedUsersToAuthors)); UpdateAuthor(user); Console.Title = $"Zemi | AuthorScraper | index {handledRecords++}"; if (max != 0 && handledRecords - skip > max) { Console.WriteLine($"Scraper done with range {skip} to {skip + max}"); } } }
public void AddRange_NullIEnumerable_ThrowsArgumentNullException() { JsonArray array = new JsonArray(); AssertExtensions.Throws <ArgumentNullException>("items", () => array.AddRange((IEnumerable <JsonValue>)null)); }
private JsonDictionary SingleAnalysis(List <JsonDictionary> data_source, string key, int i, string time_key) { var test = new Dictionary <string, List <string> >(); test.Add("support", new List <string>()); test.Add("resistance", new List <string>()); test.Add("result", new List <string>()); var analysis_data = data_source; var max = analysis_data.Aggregate <JsonDictionary>((arg1, arg2) => { return(double.Parse(arg1[key].ToString()) > double.Parse(arg2[key].ToString()) ? arg1 : arg2); }); var min = analysis_data.Aggregate <JsonDictionary>((arg1, arg2) => { return(double.Parse(arg1[key].ToString()) < double.Parse(arg2[key].ToString()) ? arg1 : arg2); }); Segmentation(ref test, ref analysis_data, analysis_data, key, double.Parse(max[key].ToString()), double.Parse(min[key].ToString()), time_key); var datum = analysis_data[i - 1]; int calc_cnt = 0; double life_price = 0; for (int m = 0; m < 60; m++) { var index = analysis_data.Count - m - 1; if (index < 0) { break; } else { if (calc_cnt == 20) { data_source[i - 1].Add("20평균가", life_price / calc_cnt); } life_price += double.Parse(analysis_data[index][key].ToString()); } calc_cnt++; } data_source[i - 1].Add("60평균가", life_price / calc_cnt); var prevCount = 0; var currentCount = 0; var lastState = "횡보"; var supportArr = new JsonArray(); var resistanceArr = new JsonArray(); foreach (var data_key in datum.GetDictionary().Keys) { if (data_key.Contains("support")) { if (lastState == "하락") { prevCount = currentCount; currentCount = 0; } lastState = "상승"; supportArr.Add(double.Parse(datum[data_key].ToString())); currentCount++; } else if (data_key.Contains("resistance")) { if (lastState == "상승") { prevCount = currentCount; currentCount = 0; } lastState = "하락"; resistanceArr.Add(double.Parse(datum[data_key].ToString())); currentCount++; } } double price = double.Parse(datum[key].ToString()); double start_price = double.Parse(datum["시가"].ToString()); var real_support = supportArr.Where <JsonValue>(p => p.ReadAs <double>() < price); var reverse_support = supportArr.Where <JsonValue>(p => p.ReadAs <double>() > price); var real_resistance = resistanceArr.Where <JsonValue>(p => p.ReadAs <double>() > price); var reverse_resistance = resistanceArr.Where <JsonValue>(p => p.ReadAs <double>() < price); var total_support = new JsonArray(); var total_resistance = new JsonArray(); total_support.AddRange(real_support); total_support.AddRange(reverse_resistance); total_resistance.AddRange(real_resistance); total_resistance.AddRange(reverse_support); var v_pattern_real = double.Parse(real_support.Count().ToString()) / (double.Parse(reverse_support.Count().ToString()) + double.Parse(real_support.Count().ToString())) * 100; var v_pattern_reverse = double.Parse(reverse_resistance.Count().ToString()) / (double.Parse(real_resistance.Count().ToString()) + double.Parse(reverse_resistance.Count().ToString())) * 100; var v_pattern = ((double.IsNaN(v_pattern_real) || double.IsInfinity(v_pattern_real) ? 0 : v_pattern_real) + (double.IsNaN(v_pattern_reverse) || double.IsInfinity(v_pattern_reverse) ? 0 : v_pattern_reverse)); var a_pattern_real = double.Parse(real_resistance.Count().ToString()) / (double.Parse(reverse_resistance.Count().ToString()) + double.Parse(real_resistance.Count().ToString())) * 100; var a_pattern_reverse = double.Parse(reverse_support.Count().ToString()) / (double.Parse(real_support.Count().ToString()) + double.Parse(reverse_support.Count().ToString())) * 100; var a_pattern = ((double.IsNaN(a_pattern_real) || double.IsInfinity(a_pattern_real) ? 0 : a_pattern_real) + (double.IsNaN(a_pattern_reverse) || double.IsInfinity(a_pattern_reverse) ? 0 : a_pattern_reverse)); var totalState = string.Empty; if (v_pattern > a_pattern) { // 상승을 하였으며, A패턴 비율에 따라 조정강도 파악 가능 (A패턴_비율로 오름차순정렬) totalState = "상승"; } else if (v_pattern < a_pattern) { // 하락을 하였으며, V패턴 비율에 따라 반등강도 파악 가능 (V패턴_비율로 오름차순정렬) totalState = "하락"; } else { if (total_support.Count > total_resistance.Count) { totalState = "상승"; } else if (total_support.Count < total_resistance.Count) { totalState = "하락"; } else { totalState = "횡보"; } } if (start_price == 0) { lastState = "거래정지"; totalState = "거래정지"; } data_source[i - 1].Add("현재상태", lastState); data_source[i - 1].Add("전체상태", totalState); data_source[i - 1].Add("저항갯수", real_resistance.Count() + reverse_support.Count()); data_source[i - 1].Add("지지갯수", real_support.Count() + reverse_resistance.Count()); data_source[i - 1].Add("최근갯수", currentCount); data_source[i - 1].Add("과거갯수", prevCount); data_source[i - 1].Add("V패턴_비율", v_pattern); data_source[i - 1].Add("A패턴_비율", a_pattern); data_source[i - 1].Add("강도", v_pattern - a_pattern); if (test["result"].Count > 0) { var supstance = ""; foreach (var support_price in test["result"]) { supstance += support_price + ","; } supstance = supstance.Substring(0, supstance.Length - 1); data_source[i - 1].Add("지지가격대", supstance); } return(data_source[i - 1]); }
void SaveClassInfo(DocComment dc, CorePlus.Json.JsonObject obj) { string fullName = dc.FullName; obj.Add("fullName",fullName); obj.Add("source", dc.Source); if(dc.Source != null) { obj.Add("sourceFile", "data/source/" + dc.Source + ".html#" + fullName.Replace('.', '-')); } SortedList<string, DocComment> members = new SortedList<string,DocComment>(); SortedList<string, DocComment> statics = new SortedList<string, DocComment>(); if (dc.MemberType == "class" && dc.Variant.Members != null) { GetMembersAndCopyToTmpList(dc.Variant.Members, members, statics); } // 如果有成员。生成成员字段。 if(dc.Variant.Count > 0) { GetMembersAndCopyToTmpList(dc.Variant, members, statics); } if (_project.DefaultExtends != null && dc.MemberType == "class") { DocComment dc2 ; if (_data.DocComments.TryGetValue(_project.DefaultExtends, out dc2) && dc2.Variant != null) { GetMembersAndCopyToTmpList(dc2.Variant, members, statics); } } DocComment e; if(dc.Extends != null && _data.DocComments.TryGetValue(dc.Extends, out e)) { string extends = dc.Extends; if (e.Variant.Members != null) { GetMembersAndCopyToTmpList(e.Variant.Members, members, statics); } JsonArray baseClasses = new JsonArray(); obj["baseClasses"] = baseClasses; while (extends != null && _data.DocComments.TryGetValue(extends, out e)) { baseClasses.Insert(0, extends); extends = e.Extends; } } if(dc.Implements != null) { foreach(string im in dc.Implements) { if(_data.DocComments.TryGetValue(im, out e)) GetMembersAndCopyToTmpList(e.Variant, members, members); } } string memberOf = dc.FullName; SaveTmpList(members, obj, memberOf, false); SaveTmpList(statics, obj, memberOf, true); if(_extendsInfo.ContainsKey(fullName)) { JsonArray subClasses = new JsonArray(); obj["subClasses"] = subClasses; var list = _extendsInfo[fullName]; list.Sort(); subClasses.AddRange(list); } foreach(string key in dc){ AddSingle(obj, key, dc[key]); } }
public void JsonArrayAddRemoveFunctionalTest() { int seed = 1; for (int i = 0; i < iterationCount / 10; i++) { seed++; Log.Info("Seed: {0}", seed); Random rndGen = new Random(seed); bool retValue = true; JsonArray sourceJson = SpecialJsonValueHelper.CreatePrePopulatedJsonArray(seed, arrayLength); JsonValue[] cloneJson = SpecialJsonValueHelper.CreatePrePopulatedJsonValueArray(seed, 3); // JsonArray.AddRange(JsonValue[]) sourceJson.AddRange(cloneJson); if (sourceJson.Count != arrayLength + cloneJson.Length) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.AddRange(JsonValue[]) failed to function properly."); retValue = false; } else { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.AddRange(JsonValue[]) passed test."); } // JsonArray.RemoveAt(int) int count = sourceJson.Count; for (int j = 0; j < count; j++) { sourceJson.RemoveAt(0); } if (sourceJson.Count > 0) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.RemoveAt(int) failed to function properly."); retValue = false; } else { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.RemoveAt(int) passed test."); } // JsonArray.JsonType if (sourceJson.JsonType != JsonType.Array) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.JsonType failed to function properly."); retValue = false; } // JsonArray.Clear() sourceJson = SpecialJsonValueHelper.CreatePrePopulatedJsonArray(seed, arrayLength); sourceJson.Clear(); if (sourceJson.Count > 0) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.Clear() failed to function properly."); retValue = false; } else { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.Clear() passed test."); } // JsonArray.AddRange(JsonValue) sourceJson = SpecialJsonValueHelper.CreatePrePopulatedJsonArray(seed, arrayLength); // adding one additional value to the array sourceJson.AddRange(SpecialJsonValueHelper.GetRandomJsonPrimitives(seed)); if (sourceJson.Count != arrayLength + 1) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.AddRange(JsonValue) failed to function properly."); retValue = false; } else { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.AddRange(JsonValue) passed test."); } // JsonArray.AddRange(IEnumerable<JsonValue> items) sourceJson = SpecialJsonValueHelper.CreatePrePopulatedJsonArray(seed, arrayLength); MyJsonValueCollection <JsonValue> myCols = new MyJsonValueCollection <JsonValue>(); myCols.Add(new JsonPrimitive(PrimitiveCreator.CreateInstanceOfUInt32(rndGen))); string str; do { str = PrimitiveCreator.CreateInstanceOfString(rndGen); } while (str == null); myCols.Add(new JsonPrimitive(str)); myCols.Add(new JsonPrimitive(PrimitiveCreator.CreateInstanceOfDateTime(rndGen))); // adding 3 additional value to the array sourceJson.AddRange(myCols); if (sourceJson.Count != arrayLength + 3) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.AddRange(IEnumerable<JsonValue> items) failed to function properly."); retValue = false; } else { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.AddRange(IEnumerable<JsonValue> items) passed test."); } // JsonArray[index].set_Item sourceJson = SpecialJsonValueHelper.CreatePrePopulatedJsonArray(seed, arrayLength); string temp; do { temp = PrimitiveCreator.CreateInstanceOfString(rndGen); } while (temp == null); sourceJson[1] = temp; if ((string)sourceJson[1] != temp) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray[index].set_Item failed to function properly."); retValue = false; } else { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray[index].set_Item passed test."); } // JsonArray.Remove(JsonValue) count = sourceJson.Count; for (int j = 0; j < count; j++) { sourceJson.Remove(sourceJson[0]); } if (sourceJson.Count > 0) { Log.Info("[JsonArrayAddRemoveFunctionalTest] JsonArray.Remove(JsonValue) failed to function properly."); retValue = false; } if (!retValue) { Assert.Fail("[JsonArrayAddRemoveFunctionalTest] Test failed!"); } } }