Exemple #1
0
        public void GetAccessToken_Of_SejamRegistrar_Should_Throw_UriFormatException_When_Url_IsInvalidURL()
        {
            //Arrange
            SejamRegistrar authorizer = new SejamRegistrar();

            //Act
            Action validate = () => new AccessTokenRequest("", USERNAME, PASSWORD);

            //Assert
            validate.Should().Throw <UriFormatException>();
        }
Exemple #2
0
        public void GetKYCOtp_Of_SejamRegistrar_Should_Send_KycOtp_When_UrlAnduserpass_AreValid()
        {
            //Arrange
            SejamRegistrar authorizer = new SejamRegistrar();
            var            requestKyc = new KycOtpRequest(URL_KYC_OTP, GetAccessToken(), TRUE_UNIQUE_IDENTIFIER);

            //Act
            var kycOtpResult = authorizer.GetKycOtp(requestKyc);

            //Assert
            kycOtpResult.ValidationStatus.Should().BeTrue();
        }
Exemple #3
0
        public void GetAccessToken_Of_SejamRegistrar_Should_Return_Error_When_UsernameorPassword_IsInvalid()
        {
            //Arrange
            SejamRegistrar     authorizer = new SejamRegistrar();
            AccessTokenRequest request    = new AccessTokenRequest(URL_ACCESS_TOKEN, "44234", "3424");

            //Act
            var accessToken = authorizer.GetAccessToken(request);

            //Assert
            AssertError(accessToken);
        }
Exemple #4
0
        public void GetKYCOtp_Of_ThirdPartyProvider_Should_Return_Error_When_UniqueIdentifier_IsInValid()
        {
            //Arrange
            SejamRegistrar authorizer = new SejamRegistrar();
            var            requestKyc = new KycOtpRequest(URL_KYC_OTP, GetAccessToken(), "8884454112");

            //Act
            var result = authorizer.GetKycOtp(requestKyc);

            //Assert
            AssertError(result);
        }
Exemple #5
0
        public void GetKYCOtp_Of_SejamRegistrar_Should_Return_Error_When_AccessToken_IsInValid()
        {
            //Arrange
            SejamRegistrar authorizer = new SejamRegistrar();
            var            requestKyc = new KycOtpRequest(URL_KYC_OTP, GetAccessToken() + "D", TRUE_UNIQUE_IDENTIFIER);

            //Act
            var result = authorizer.GetKycOtp(requestKyc);

            //Assert
            AssertError(result);
        }
Exemple #6
0
        public void GetAccessToken_Of_SejamRegistrar_Should_Return_Error_When_UsernameorPassword_IsEmpty()
        {
            //Arrange
            SejamRegistrar     authorizer = new SejamRegistrar();
            AccessTokenRequest request    = new AccessTokenRequest(URL_ACCESS_TOKEN, "", "");

            //Act
            var accessToken = authorizer.GetAccessToken(request);

            //Assert
            AssertError(accessToken);
            accessToken.ValidationMessages[0].Code.Should().Be("400");
        }
Exemple #7
0
        public void GetAccessToken_Of_SejamRegistrar_Should_Return_Error_When_Url_IsNotAccessible()
        {
            //Arrange
            SejamRegistrar     authorizer = new SejamRegistrar();
            AccessTokenRequest request    =
                new AccessTokenRequest(URL_ACCESS_TOKEN + "pp", USERNAME, PASSWORD);

            //Act
            var accessToken = authorizer.GetAccessToken(request);

            //Assert
            AssertError(accessToken);
        }
Exemple #8
0
        public void GetAccessToken_Of_SejamRegistrar_Should_Return_AccessToken_When_UrlAnduserpass_AreValid()
        {
            //Arrange
            SejamRegistrar     authorizer = new SejamRegistrar();
            AccessTokenRequest request    =
                new AccessTokenRequest(URL_ACCESS_TOKEN, USERNAME, PASSWORD);

            //Act
            var accessToken = authorizer.GetAccessToken(request);

            //Assert
            accessToken.ValidationStatus.Should().BeTrue();
            accessToken.Token.Should().NotBeNull();
        }
        private void GetAccessToken()
        {
            SejamRegistrar     authorizer = new SejamRegistrar();
            AccessTokenRequest request    =
                new AccessTokenRequest(
                    SejamRegistrarTests.URL_ACCESS_TOKEN,
                    SejamRegistrarTests.USERNAME,
                    SejamRegistrarTests.PASSWORD);
            var accessToken = authorizer.GetAccessToken(request);

            if (accessToken != null)
            {
                this.aToken      = accessToken;
                this.lastGetTime = DateTime.Now;
            }
        }
Exemple #10
0
        public void GetKYC_Of_ThirdPartyProvider_Should_SendKYC_When_UniqueIdentifierAndOtpIsValid()
        {
            //Arrange-Send OTPRequest Manual
            SejamRegistrar authorizer = new SejamRegistrar();

            var kycRequest = new KYCRequest(
                GetAccessToken(),
                URL_KYC,
                TRUE_UNIQUE_IDENTIFIER,
                "83458"
                );

            //Act
            var result = authorizer.GetKYC(kycRequest);

            //Assert
            result.ValidationStatus.Should().BeTrue();
            result.UniqueIdentifier.Should().NotBeNullOrEmpty();
        }