private String CreateKiiExperimentAsJsonString(int experimentVersion, KiiExperimentStatus status, string variationNameA, string eventNameA, string variationNameB, string eventNameB) { StringBuilder sb = new StringBuilder(); sb.AppendLine("{"); sb.AppendLine("\"_id\"" + ":" + "\"ID-001\"" + ","); sb.AppendLine("\"description\"" + ":" + "\"Experiment for UT\"" + ","); sb.AppendLine("\"version\"" + ":" + experimentVersion + ","); sb.AppendLine("\"status\"" + ":" + ((int)status) + ","); sb.AppendLine("\"conversionEvents\"" + ":"); sb.Append("["); sb.Append("{\"name\":\"" + eventNameA + "\"}"); sb.Append(","); sb.Append("{\"name\":\"" + eventNameB + "\"}"); sb.Append("],"); sb.AppendLine("\"variations\"" + ":"); sb.Append("["); sb.Append("{\"name\":\"" + variationNameA + "\", \"percentage\":50, \"variableSet\":{}}"); sb.Append(","); sb.Append("{\"name\":\"" + variationNameB + "\", \"percentage\":50, \"variableSet\":{}}"); sb.Append("]"); sb.AppendLine("}"); return(sb.ToString()); }
private String CreateKiiExperimentAsJsonString(KiiExperimentStatus status, int percentageA, int percentageB, string chosenVariationName) { StringBuilder sb = new StringBuilder(); sb.AppendLine("{"); sb.AppendLine("\"_id\"" + ":" + "\"ID-001\"" + ","); sb.AppendLine("\"description\"" + ":" + "\"Experiment for UT\"" + ","); sb.AppendLine("\"version\"" + ":" + "1" + ","); sb.AppendLine("\"status\"" + ":" + ((int)status) + ","); sb.AppendLine("\"conversionEvents\"" + ":"); sb.Append("["); sb.Append("{\"name\":\"Event-A\"}"); sb.Append(","); sb.Append("{\"name\":\"Event-B\"}"); sb.Append("],"); sb.AppendLine("\"variations\"" + ":"); sb.Append("["); sb.Append("{\"name\":\"A\", \"percentage\":" + percentageA + ", \"variableSet\":{}}"); sb.Append(","); sb.Append("{\"name\":\"B\", \"percentage\":" + percentageB + ", \"variableSet\":{}}"); sb.Append("]"); if (!Utils.IsEmpty (chosenVariationName)) { sb.Append(","); sb.AppendLine("\"chosenVariation\"" + ":" + "\"" + chosenVariationName + "\""); } sb.AppendLine("}"); return sb.ToString (); }
/// <summary> /// Initializes a new instance of the <see cref="KiiCorp.Cloud.ABTesting.Variation"/> class. /// </summary> /// <remarks> /// </remarks> internal Variation(KiiExperiment parentExperiment, string name, int percentage, JsonObject variableSet) { this.mParentExperimentID = parentExperiment.ID; this.mParentExperimentVersion = parentExperiment.Version; this.mParentExperimentConversionEvents = parentExperiment.ConversionEvents; mParentExperimentStatus = parentExperiment.Status; this.mName = name; this.mPercentage = percentage; this.mVariableSet = variableSet; }
private String CreateKiiExperimentAsJsonString(string id, string description, int version, KiiExperimentStatus status, string variationNameA, string eventNameA, int percentageA, string variableSetA, string variationNameB, string eventNameB, int percentageB, string variableSetB, string chosenVariationName) { StringBuilder sb = new StringBuilder(); sb.AppendLine("{"); sb.AppendLine("\"_id\"" + ":" + "\"" + id + "\"" + ","); sb.AppendLine("\"description\"" + ":" + "\"" + description + "\"" + ","); sb.AppendLine("\"version\"" + ":" + version + ","); sb.AppendLine("\"status\"" + ":" + ((int)status) + ","); sb.AppendLine("\"conversionEvents\"" + ":"); sb.Append("["); sb.Append("{\"name\":\"" + eventNameA + "\"}"); sb.Append(","); sb.Append("{\"name\":\"" + eventNameB + "\"}"); sb.Append("],"); sb.AppendLine("\"variations\"" + ":"); sb.Append("["); sb.Append("{\"name\":\"" + variationNameA + "\", \"percentage\":" + percentageA + ", \"variableSet\":" + variableSetA + "}"); sb.Append(","); sb.Append("{\"name\":\"" + variationNameB + "\", \"percentage\":" + percentageB + ", \"variableSet\":" + variableSetB + "}"); sb.Append("]"); if (!Utils.IsEmpty(chosenVariationName)) { sb.Append(","); sb.AppendLine("\"chosenVariation\"" + ":" + "\"" + chosenVariationName + "\""); } sb.AppendLine("}"); return(sb.ToString()); }