private void PostRules() { foreach (var rule in _model.rules) { var ja = new JArray(); foreach (var configItem in rule.configItems) { ja.Add(new JObject { ["key"] = configItem.name, ["values"] = new JArray(configItem.value), ["type"] = configItem.type }); } var newRule = new JObject { ["projectId"] = Application.cloudProjectId, ["environmentId"] = _data.environmentId, ["configId"] = _data.configId, ["id"] = Guid.NewGuid().ToString(), ["name"] = rule.name, ["enabled"] = rule.enabled, ["condition"] = rule.conditions, ["rolloutPercentage"] = rule.rolloutPercentage, ["startDate"] = "", ["endDate"] = "", ["type"] = "segmentation", ["value"] = ja }; RemoteConfigWebApiClient.PostAddRule(Application.cloudProjectId, _data.environmentId, _data.configId, newRule, OnException); } Debug.Log("RemoteConfigHelper Done"); }
public void PostAddRule_ThrowsArgumentExceptionOnBadArgs() { try { RemoteConfigWebApiClient.PostAddRule(null, null, null, new JObject()); } catch (ArgumentException ex) { Assert.That(ex.GetType() == typeof(ArgumentException)); } }