Exemplo n.º 1
0
        public void ThenUserHasCustomPropertyWithTheValue(string userName, string customPropertyName, string customPropertyValue)
        {
            Guid  userId = MockDatabase.GetUser(userName).Id;
            IUser user   = IdentityManagementService.GetUser(userId);

            Assert.IsTrue(user.CustomProperties.Any(p => p.Name.Equals(customPropertyName) && p.Value.Equals(customPropertyValue)));
        }
Exemplo n.º 2
0
        public void WhenActiveDirectoryAccountNameIsChangedToForUser(string accountName, string userName)
        {
            Guid  userId = nameIdentifierPairs[userName];
            IUser user   = IdentityManagementService.GetUser(userId);

            Try(() => IdentityManagementService.UpdateExternalUserAccount(user.Id, AccountType.ActiveDirectory, accountName));
        }
Exemplo n.º 3
0
        public void ThenTheUserIsInTheFollowingOrganizations(string userName, Table expectedOrganizations)
        {
            IUser user = IdentityManagementService.GetUser(nameIdentifierPairs[userName]);

            Assert.AreEqual(expectedOrganizations.RowCount, user.Organizations.Count);
            foreach (TableRow row in expectedOrganizations.Rows)
            {
                Assert.IsNotNull(user.Organizations.SingleOrDefault(o => o.Name == row["Organization"]));
            }
        }
Exemplo n.º 4
0
        public void ThenTheUserHasTheFollowingCustomProperties(string userName, Table expectedCustomProperties)
        {
            Guid userId = MockDatabase.GetUser(userName).Id;
            IReadOnlyCollection <ICustomProperty> customProperties = IdentityManagementService.GetUser(userId).CustomProperties;

            Assert.AreEqual(expectedCustomProperties.RowCount, customProperties.Count);

            foreach (TableRow expectedCustomProperty in expectedCustomProperties.Rows)
            {
                Assert.IsTrue(customProperties.Any(c => c.Name == expectedCustomProperty["Name"] && c.Value == expectedCustomProperty["Value"]));
            }
        }
Exemplo n.º 5
0
        public void ThenTheUserHasTheFollowingRoles(string userName, Table expectedRoles)
        {
            Guid userId = MockDatabase.GetUser(userName).Id;
            IReadOnlyCollection <IRole> roles = IdentityManagementService.GetUser(userId).Roles;

            Assert.AreEqual(expectedRoles.RowCount, roles.Count);

            foreach (TableRow expectedRole in expectedRoles.Rows)
            {
                Assert.IsTrue(roles.Any(r => r.Name.Equals(expectedRole["Role"])));
            }
        }
Exemplo n.º 6
0
        public void ThenTheUserIsInNoOrganization(string userName)
        {
            IUser user = IdentityManagementService.GetUser(nameIdentifierPairs[userName]);

            Assert.AreEqual(0, user.Organizations.Count);
        }
Exemplo n.º 7
0
        public void ThenTheUserHasNoRoles(string user)
        {
            IEnumerable <IRole> roles = IdentityManagementService.GetUser(nameIdentifierPairs[user]).Roles;

            Assert.IsFalse(roles.Any());
        }
Exemplo n.º 8
0
        public void ThenTheUserIsDisabled(string name)
        {
            IUser user = IdentityManagementService.GetUser(nameIdentifierPairs[name]);

            Assert.IsTrue(user.IsDisabled);
        }