/// <summary> /// Update the AB Test details with the JSON content coming from the Swrve servers. /// </summary> /// <param name="abTestDetailsJson"> /// JSON response coming from the Swrve servers. /// </param> public void SetABTestDetailsFromJSON(Dictionary <string, object> abTestDetailsJson) { List <SwrveABTestDetails> abTestDetails = new List <SwrveABTestDetails> (); Dictionary <string, object> .Enumerator enumerator = abTestDetailsJson.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <string, object> abTestDetailsPair = enumerator.Current; if (abTestDetailsPair.Value is Dictionary <string, object> ) { Dictionary <string, object> abTestDetailsDic = (Dictionary <string, object>)abTestDetailsPair.Value; string name = (string)abTestDetailsDic ["name"]; int caseIndex = MiniJsonHelper.GetInt(abTestDetailsDic, "case_index", 0); SwrveABTestDetails newDetails = new SwrveABTestDetails(abTestDetailsPair.Key, name, caseIndex); abTestDetails.Add(newDetails); } } ABTestDetails = abTestDetails; }
public void SetABTestDetailsFromJSON(Dictionary <string, object> abTestDetailsJson) { List <SwrveABTestDetails> list = new List <SwrveABTestDetails>(); Dictionary <string, object> .Enumerator enumerator = abTestDetailsJson.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <string, object> current = enumerator.Current; if (current.Value is Dictionary <string, object> ) { Dictionary <string, object> dictionary = (Dictionary <string, object>)current.Value; string name = (string)dictionary["name"]; int @int = MiniJsonHelper.GetInt(dictionary, "case_index", 0); SwrveABTestDetails item = new SwrveABTestDetails(current.Key, name, @int); list.Add(item); } } ABTestDetails = list; }