public void TaskACLIndex() { clearTest(); // Add one object to be sure the test will not fail because index is empty var res = _index.AddObject(JObject.Parse(@"{""name"":""San Francisco"", ""population"":805235}"), "myID"); _index.WaitTask(res["taskID"].ToString()); var key = _index.AddUserKey(new String[] { "search" }); WaitKey(_index, key); Assert.IsFalse(string.IsNullOrWhiteSpace(key["key"].ToString())); key = _index.AddApiKey(new String[] { "search" }); WaitKey(_index, key); Assert.IsFalse(string.IsNullOrWhiteSpace(key["key"].ToString())); var getKey = _index.GetUserKeyACL(key["key"].ToString()); Assert.AreEqual(key["key"], getKey["value"]); getKey = _index.GetApiKeyACL(key["key"].ToString()); Assert.AreEqual(key["key"], getKey["value"]); var keys = _index.ListUserKeys(); Assert.IsTrue(Include((JArray)keys["keys"], "value", key["key"].ToString())); keys = _index.ListApiKeys(); Assert.IsTrue(Include((JArray)keys["keys"], "value", key["key"].ToString())); _index.UpdateApiKey(key["key"].ToString(), new String[] { "addObject" }); WaitKey(_index, key, "addObject"); getKey = _index.GetUserKeyACL(key["key"].ToString()); Assert.AreEqual((string)getKey["acl"][0], "addObject"); getKey = _index.GetApiKeyACL(key["key"].ToString()); Assert.AreEqual((string)getKey["acl"][0], "addObject"); _index.DeleteApiKey(key["key"].ToString()); WaitKeyMissing(_index, key); keys = _index.ListUserKeys(); Assert.IsFalse(Include((JArray)keys["keys"], "value", key["key"].ToString())); }