示例#1
0
        public void RenewLease_UserDoesNotExists_ExecutesFine()
        {
            using (ShimsContext.Create())
            {
                // Act
                var actualResult = LdapSsoDal.RenewLease(Guid.NewGuid(), "PP", TEST_PASSWORD);

                // Assert
                actualResult.ShouldNotBeNull();
            }
        }
示例#2
0
        public void AutheticateUser_CorrectUserIncorrectPassword_ReturnsSuccess()
        {
            using (ShimsContext.Create())
            {
                // Act
                AuthenticationResult actualResult = LdapSsoDal.AutheticateUser(TEST_USERNAME, TEST_PASSWORD);

                // Assert
                actualResult.ShouldBe(AuthenticationResult.SUCCESS);
            }
        }
示例#3
0
        public void AutheticateUser_CorrectUserRenewLease_ReturnsSuccess()
        {
            using (ShimsContext.Create())
            {
                // Act
                AuthenticationResult actualResult = LdapSsoDal.AutheticateUser(TEST_USERNAME, string.Empty);

                // Assert
                actualResult.ShouldBe(AuthenticationResult.SUCCESS);
            }
        }
示例#4
0
        public void GetUserGroups_ExecutesFine()
        {
            using (ShimsContext.Create())
            {
                // Act
                var actualResult = LdapSsoDal.GetUserGroups(TEST_USERNAME);

                // Assert
                actualResult.ShouldNotBeNull();
                actualResult.Count.ShouldBe(1);
            }
        }
        public void AutheticateUserLdap_FindByIdentityThrowsException_ReturnsNull()
        {
            using (ShimsContext.Create())
            {
                // Arrange
                ShimPrincipalContext.ConstructorContextTypeStringStringContextOptionsStringString = (a, b, c, d, e, f, g) => { new ShimPrincipalContext(); };
                ShimUserPrincipal.FindByIdentityPrincipalContextIdentityTypeString = (a, b, c) =>
                {
                    throw new ApplicationException("This is test exception");
                };
                ShimPrincipal.AllInstances.DistinguishedNameGet = (a) => { return("test"); };
                ShimPrincipal.AllInstances.GuidGet = (a) => { return(Guid.NewGuid()); };

                // Act
                var actualReturn = LdapSsoDal.AutheticateUserLdap(string.Empty, string.Empty);

                // Assert
                actualReturn.ShouldBeNull();
            }
        }