Exemple #1
0
        public async Task Member()
        {
            var bucket = await _bucketsApi.CreateBucket(GenerateName("robot sensor"), RetentionRule(), _organization);

            var members = await _bucketsApi.GetMembers(bucket);

            Assert.AreEqual(0, members.Count);

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

            var resourceMember = await _bucketsApi.AddMember(user, bucket);

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

            members = await _bucketsApi.GetMembers(bucket);

            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 _bucketsApi.DeleteMember(user, bucket);

            members = await _bucketsApi.GetMembers(bucket);

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