Beispiel #1
0
        public async Task Owner()
        {
            var organization = await _organizationsApi.CreateOrganization(GenerateName("Constant Pro"));

            var owners = await _organizationsApi.GetOwners(organization);

            Assert.AreEqual(1, owners.Count);
            Assert.AreEqual("my-user", owners[0].Name);

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

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

            Assert.IsNotNull(resourceMember);
            Assert.AreEqual(resourceMember.Id, user.Id);
            Assert.AreEqual(resourceMember.Name, user.Name);
            Assert.AreEqual(resourceMember.Role, ResourceOwner.RoleEnum.Owner);

            owners = await _organizationsApi.GetOwners(organization);

            Assert.AreEqual(2, owners.Count);
            Assert.AreEqual(owners[1].Id, user.Id);
            Assert.AreEqual(owners[1].Name, user.Name);
            Assert.AreEqual(owners[1].Role, ResourceOwner.RoleEnum.Owner);

            await _organizationsApi.DeleteOwner(user, organization);

            owners = await _organizationsApi.GetOwners(organization);

            Assert.AreEqual(1, owners.Count);
        }