예제 #1
0
        public async Task GroupTestAsync()
        {
            var group = await client.CreateGroupAsync(new CreateGroupParams("TestGroup")
            {
                Members = new[] { ownUser.Id }
            });

            Assert.AreNotEqual(group.Id, 0L);
            Assert.AreEqual(group.Name, "TestGroup");
            Assert.IsTrue(group.Members.Any(x => x.Id == ownUser.Id));

            var groupGet = await client.GetGroupAsync(group.Id);

            Assert.AreEqual(groupGet.Id, group.Id);
            Assert.AreEqual(groupGet.Name, group.Name);
            Assert.IsTrue(groupGet.Members.Any(x => x.Id == ownUser.Id));

            var groupUpdated = await client.UpdateGroupAsync(new UpdateGroupParams(group.Id)
            {
                Name    = "TestGroupUpdated",
                Members = new[] { anotherUser.Id }
            });

            Assert.AreEqual(groupUpdated.Id, group.Id);
            Assert.AreEqual(groupUpdated.Name, "TestGroupUpdated");
            Assert.IsTrue(groupGet.Members.Any(x => x.Id == anotherUser.Id));

            await client.GetGroupsAsync(new OffsetParams()
            {
                Count = 100, Offset = 1, Order = Order.Desc
            });

            var groupDeleted = await client.DeleteGroupAsync(groupUpdated.Id);

            Assert.AreEqual(groupDeleted.Id, groupDeleted.Id);
            Assert.AreEqual(groupDeleted.Name, groupDeleted.Name);
            Assert.IsTrue(groupDeleted.Members.Any(x => x.Id == anotherUser.Id));
        }