public async Task TestDeleteMany() { var user = new User() { ID = Guid.NewGuid().ToString(), Role = Role.Admin, }; user.SetData("name", "BOB"); user.SetData("details", new Dictionary <string, string>() { { "foo", "bar" } }); await this._endpoint.Upsert(user); DeleteUsersRequest deleteUsersRequest = new DeleteUsersRequest() .WithUserIDs(new string[] { user.ID }) .WithUserDelete("hard"); var taskId = await this._endpoint.DeleteMany(deleteUsersRequest); var complete = false; var iterations = 0; StreamChat.TaskStatus resp = null; while (!complete && iterations < 1000) { resp = await this._client.GetTaskStatus(taskId); if (resp.Status.Equals("completed")) { complete = true; } iterations++; await Task.Delay(100); } Assert.IsNotNull(resp); Assert.IsNotNull(resp.Result); var userStatus = JsonConvert.DeserializeObject <Dictionary <string, string> >(JsonConvert.SerializeObject(resp.Result[user.ID])); Assert.IsNotNull(userStatus); Assert.AreEqual("ok", userStatus["status"]); }
public async Task TestDeleteChannels() { var user1 = new User() { ID = Guid.NewGuid().ToString(), Role = Role.Admin, }; await this._client.Users.Upsert(user1); var id = Guid.NewGuid().ToString(); var channel = this._client.Channel("messaging", id); await channel.Create(user1.ID, new string[] { user1.ID }); var cid = "messaging:" + id; var taskId = await this._client.DeleteChannels(new string[] { cid }, true); var complete = false; var iterations = 0; StreamChat.TaskStatus resp = null; while (!complete && iterations < 1000) { resp = await this._client.GetTaskStatus(taskId); if (resp.Status.Equals("completed")) { complete = true; } iterations++; await Task.Delay(100); } Assert.IsNotNull(resp); Assert.IsNotNull(resp.Result); var cidStatus = JsonConvert.DeserializeObject <Dictionary <string, string> >(JsonConvert.SerializeObject(resp.Result[cid])); Assert.IsNotNull(cidStatus); Assert.AreEqual("ok", cidStatus["status"]); }