public async Task TestChannelCreate() { var user1 = new User() { ID = Guid.NewGuid().ToString(), Role = Role.Admin, }; user1.SetData("name", "BOB"); var user2 = new User() { ID = Guid.NewGuid().ToString(), Role = Role.User, }; user2.SetData("details", new Dictionary <string, string>() { { "foo", "bar" } }); var members = new User[] { user1, user2 }; await this._client.Users.UpdateMany(members); var chanData = new GenericData(); chanData.SetData("name", "one big party"); chanData.SetData("food", new string[] { "pizza", "gabagool" }); var channel = _client.Channel("messaging", null, chanData); var chanState = await channel.Create(user1.ID, members.Select(u => u.ID)); Assert.AreEqual(chanState.Channel.ID, channel.ID); Assert.AreEqual(2, chanState.Channel.MemberCount); Assert.AreEqual(2, chanState.Members.Count); var u1 = chanState.Members.Find(u => u.User.ID == user1.ID); Assert.NotNull(u1); Assert.AreEqual(u1.Role, ChannelRole.Owner); Assert.AreEqual(u1.User.GetData <string>("name"), user1.GetData <string>("name")); Assert.NotNull(u1.UpdatedAt); var u2 = chanState.Members.Find(u => u.User.ID == user2.ID); Assert.NotNull(u2); Assert.AreEqual(u2.Role, ChannelRole.Member); Assert.AreEqual(u2.User.GetData <Dictionary <string, string> >("details")["foo"], user2.GetData <Dictionary <string, string> >("details")["foo"]); Assert.NotNull(u2.UpdatedAt); Assert.NotNull(chanState.Channel.CreatedBy); Assert.AreEqual(chanState.Channel.CreatedBy.ID, user1.ID); Assert.AreEqual(chanState.Channel.CreatedBy.Role, user1.Role); Assert.AreEqual(chanState.Channel.GetData <string>("name"), chanData.GetData <string>("name")); Assert.AreEqual(chanState.Channel.GetData <string[]>("food"), chanData.GetData <string[]>("food")); var chanId = Guid.NewGuid().ToString(); var channel2 = _client.Channel("messaging", chanId); chanState = await channel2.Create(user2.ID); Assert.AreEqual(chanState.Channel.ID, channel2.ID); Assert.AreEqual(chanId, channel2.ID); Assert.AreEqual(0, chanState.Channel.MemberCount); Assert.AreEqual(0, chanState.Members.Count); Assert.AreEqual(chanState.Channel.CreatedBy.ID, user2.ID); }