예제 #1
0
        public async Task Member()
        {
            var organization = await _organizationsApi.CreateOrganizationAsync(GenerateName("Constant Pro"));

            var members = await _organizationsApi.GetMembersAsync(organization);

            Assert.AreEqual(0, members.Count);

            var user = await _usersApi.CreateUserAsync(GenerateName("Luke Health"));

            var resourceMember = await _organizationsApi.AddMemberAsync(user, organization);

            Assert.IsNotNull(resourceMember);
            Assert.AreEqual(resourceMember.Id, user.Id);
            Assert.AreEqual(resourceMember.Name, user.Name);
            Assert.AreEqual(resourceMember.Role, ResourceMember.RoleEnum.Member);

            members = await _organizationsApi.GetMembersAsync(organization);

            Assert.AreEqual(1, members.Count);
            Assert.AreEqual(members[0].Id, user.Id);
            Assert.AreEqual(members[0].Name, user.Name);
            Assert.AreEqual(members[0].Role, ResourceMember.RoleEnum.Member);

            await _organizationsApi.DeleteMemberAsync(user, organization);

            members = await _organizationsApi.GetMembersAsync(organization);

            Assert.AreEqual(0, members.Count);
        }