コード例 #1
0
        public void GetAuthResults_sendRequestWithoutRelyingPartyId_success()
        {
            AuthenticationResultsRequest authenticationResultsRequest = AuthenticationResultsRequest.Create();
            String authenticationResultsResponseString = jsonService.SerializeToJson(authenticationResults);

            StartMockServer(authenticationResultsRequest, (int)HttpStatusCode.OK, authenticationResultsResponseString);

            List <AuthenticationResult> response = authenticationClient.GetResults(authenticationResultsRequest);

            Assert.AreEqual(REFERENCE, response[0].AuthRef);
        }
コード例 #2
0
        private void GetAuthenticationResults(AuthenticationResultsRequest getAuthenticationResultsRequest, TransactionContext transactionContext, string relyingPartyId)
        {
            AuthenticationResults expectedResponse     = PrepareAuthenticationResultsResponse();
            IAuthenticationClient authenticationClient = AuthenticationClient.Create(SslSettings.Create(TestKeystoreUtil.GetKeystorePath(TestKeystoreUtil.KEYSTORE_PATH_PKCS12), TestKeystoreUtil.KEYSTORE_PASSWORD, TestKeystoreUtil.GetKeystorePath(TestKeystoreUtil.CERTIFICATE_PATH)), FrejaEnvironment.TEST)
                                                         .SetHttpService(CommonTestData.HttpServiceMock.Object)
                                                         .SetTransactionContext(transactionContext).Build <AuthenticationClient>();

            CommonTestData.HttpServiceMock.Setup(x => x.Send <AuthenticationResults>(It.IsAny <Uri>(), It.IsAny <string>(), It.IsAny <AuthenticationResultsRequest>(), It.IsAny <string>())).Returns(expectedResponse);
            List <AuthenticationResult> response = authenticationClient.GetResults(getAuthenticationResultsRequest);

            if (transactionContext.Equals(TransactionContext.PERSONAL))
            {
                CommonTestData.HttpServiceMock.Verify(x => x.Send <AuthenticationResults>(new Uri(FrejaEnvironment.TEST + MethodUrl.AUTHENTICATION_GET_RESULTS), RequestTemplate.AUTHENTICATION_RESULTS_TEMPLATE, getAuthenticationResultsRequest, relyingPartyId));
            }
            else
            {
                CommonTestData.HttpServiceMock.Verify(x => x.Send <AuthenticationResults>(new Uri(FrejaEnvironment.TEST + MethodUrl.ORGANISATION_AUTHENTICATION_GET_RESULTS), RequestTemplate.AUTHENTICATION_RESULTS_TEMPLATE, getAuthenticationResultsRequest, relyingPartyId));
            }
            AuthenticationResult first = response[0];

            Assert.AreEqual(CommonTestData.REFERENCE, first.AuthRef);
            Assert.AreEqual(TransactionStatus.STARTED, first.Status);
            Assert.AreEqual(CommonTestData.DETAILS, first.Details);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.BasicUserInfo.Name, first.RequestedAttributes.BasicUserInfo.Name);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.BasicUserInfo.Surname, first.RequestedAttributes.BasicUserInfo.Surname);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.DateOfBirth, first.RequestedAttributes.DateOfBirth);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.EmailAddress, first.RequestedAttributes.EmailAddress);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.CustomIdentifier, first.RequestedAttributes.CustomIdentifier);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.Ssn.Country, first.RequestedAttributes.Ssn.Country);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.Ssn.Ssn, first.RequestedAttributes.Ssn.Ssn);
            Assert.AreEqual(CommonTestData.REQUESTED_ATTRIBUTES.OrganisationIdIdentifier, first.RequestedAttributes.OrganisationIdIdentifier);
            AuthenticationResult second = response[1];

            Assert.AreEqual(CommonTestData.REFERENCE, second.AuthRef);
            Assert.AreEqual(TransactionStatus.DELIVERED_TO_MOBILE, second.Status);
            Assert.AreEqual(CommonTestData.DETAILS, second.Details);
            Assert.AreEqual(CommonTestData.CUSTOM_IDENTIFIER, second.RequestedAttributes.CustomIdentifier);
        }
コード例 #3
0
 public void GetResults_requestNull_expectError()
 {
     ValidateRequest_expectError("Request cannot be null value.", () => authenticationClient.GetResults(null));
 }