Пример #1
0
        public void AuthenticateUser_LdapSsoDalAutheticateUser_Success_ReturnsSuccess()
        {
            using (ShimsContext.Create())
            {
                // Arrange
                LdapSso.DataAccess.Fakes.ShimLdapSsoDal.AutheticateUserStringString = (a, b) => { return(AuthenticationResult.SUCCESS); };
                LdapSso.DataAccess.Fakes.ShimLdapSsoDal.RenewLeaseGuidStringString  = (a, b, c) => { return(true); };
                LdapSsoService ldapSsoService = new LdapSsoService();

                // Act
                AuthenticationResult actualResult = ldapSsoService.AuthenticateUser(TEST_USERNAME, TEST_PASSWORD);

                // Assert
                actualResult.ShouldBe(AuthenticationResult.SUCCESS);
            }
        }
Пример #2
0
        public void AuthenticateUser_LdapSsoDalAutheticateUser_UserDoesNotExistsLdapGuidNull_InvalidCredentails()
        {
            using (ShimsContext.Create())
            {
                // Arrange
                LdapSso.DataAccess.Fakes.ShimLdapSsoDal.AutheticateUserStringString          = (a, b) => { return(AuthenticationResult.USER_DOES_NOT_EXISTS); };
                LdapSso.DataAccess.Fakes.ShimLdapSsoDal.RenewLeaseGuidStringString           = (a, b, c) => { return(true); };
                LdapSso.DirectoryAccess.Fakes.ShimLdapSsoDal.AutheticateUserLdapStringString = (a, b) => { return(null); };

                LdapSsoService ldapSsoService = new LdapSsoService();

                // Act
                AuthenticationResult actualResult = ldapSsoService.AuthenticateUser(TEST_USERNAME, TEST_PASSWORD);

                // Assert
                actualResult.ShouldBe(AuthenticationResult.INVALID_CREDENTIALS);
            }
        }
Пример #3
0
        public void AuthenticateUser_LdapSsoDalAutheticateUser_UserDoesNotExistsLdapValidGuid_ReturnsSuccess()
        {
            using (ShimsContext.Create())
            {
                // Arrange
                LdapSso.DataAccess.Fakes.ShimLdapSsoDal.AutheticateUserStringString          = (a, b) => { return(AuthenticationResult.USER_DOES_NOT_EXISTS); };
                LdapSso.DataAccess.Fakes.ShimLdapSsoDal.RenewLeaseGuidStringString           = (a, b, c) => { return(true); };
                LdapSso.DirectoryAccess.Fakes.ShimLdapSsoDal.AutheticateUserLdapStringString = (a, b) => { return(Guid.NewGuid()); };

                LdapSsoService ldapSsoService = new LdapSsoService();

                // Act
                AuthenticationResult actualResult = ldapSsoService.AuthenticateUser(TEST_USERNAME, TEST_PASSWORD);

                // Assert
                actualResult.ShouldBe(AuthenticationResult.SUCCESS);
            }
        }