コード例 #1
0
 public void TestInitialize()
 {
     jsonService = new JsonService();
     initiateAuthenticationResponse = new InitiateAuthenticationResponse(REFERENCE);
     authenticationResult           = new AuthenticationResult(REFERENCE, TransactionStatus.STARTED, null, null);
     authenticationResultWithRequestedAttributes = new AuthenticationResult(REFERENCE, TransactionStatus.APPROVED, DETAILS, REQUESTED_ATTRIBUTES);
     authenticationResults = new AuthenticationResults(new List <AuthenticationResult> {
         authenticationResult
     });
     authenticationClient = AuthenticationClient.Create(SslSettings.Create(TestKeystoreUtil.GetKeystorePath(TestKeystoreUtil.KEYSTORE_PATH_PKCS12), TestKeystoreUtil.KEYSTORE_PASSWORD, TestKeystoreUtil.GetKeystorePath(TestKeystoreUtil.CERTIFICATE_PATH)), FrejaEnvironment.TEST)
                            .SetTestModeCustomUrl(CUSTOM_URL).SetTransactionContext(TransactionContext.PERSONAL).Build <AuthenticationClient>();
     StopServer();
 }
        private void RelyingPartyNull_success(InitiateAuthenticationRequest initiateAuthenticationRequest)
        {
            InitiateAuthenticationResponse expectedResponse = new InitiateAuthenticationResponse(CommonTestData.REFERENCE);

            CommonTestData.HttpServiceMock.Setup(x => x.Send <InitiateAuthenticationResponse>(It.IsAny <Uri>(), It.IsAny <string>(), It.IsAny <InitiateAuthenticationRequest>(), null)).Returns(expectedResponse);

            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.PERSONAL).Build <AuthenticationClient>();
            string reference = authenticationClient.Initiate(initiateAuthenticationRequest);

            CommonTestData.HttpServiceMock.Verify(x => x.Send <InitiateAuthenticationResponse>(new Uri(FrejaEnvironment.TEST + MethodUrl.AUTHENTICATION_INIT), RequestTemplate.INIT_AUTHENTICATION_TEMPLATE, initiateAuthenticationRequest, null));
            Assert.AreEqual(CommonTestData.REFERENCE, reference);
        }