Example #1
0
        public void AddRemoveUserFromGroup()
        {
            // Arrange
            var ssoAdminClient = new SsoAdminClient(_vc, _user, _password, new AcceptAllX509CertificateValidator());

            var expectedUserName = "******";
            var expectedPassword = "******";
            var newUser          = ssoAdminClient.CreateLocalUser(
                expectedUserName,
                expectedPassword);

            var group = ssoAdminClient.GetGroups("administrators", newUser.Domain).FirstOrDefault <Group>();

            // Act
            var addActual    = ssoAdminClient.AddPersonUserToGroup(newUser, group);
            var removeActual = ssoAdminClient.RemovePersonUserFromGroup(newUser, group);

            // Assert
            Assert.IsTrue(addActual);
            Assert.IsTrue(removeActual);

            // Cleanup
            ssoAdminClient.DeleteLocalUser(
                newUser);
        }