コード例 #1
0
        public async Task SentOtpAsync()
        {
            Case sampleCase = GenerateSampleCase();
            Case returnCase = await ApiClient.PostCaseAsync(sampleCase);

            var detailedDecision = await ApiClient.GetDetailedDecisionAsync(returnCase.Id);

            Assert.IsTrue(detailedDecision.Authentication.OTP.Status == Enums.OTPStatus.Offered);

            DigitalAuthenticationResult auth    = GenerateDigitalAuthenticationResult();
            OTPResult checkAuthenticationResult = await ApiClient.PostOtpAsync(returnCase.Id, auth.OTP);

            Assert.IsTrue(checkAuthenticationResult.Status == Enums.OTPStatus.InProgress);
        }
コード例 #2
0
        public async Task VerifyOtpAsync()
        {
            Case sampleCase = GenerateSampleCase();
            Case returnCase = await ApiClient.PostCaseAsync(sampleCase);

            var detailedDecision = await ApiClient.GetDetailedDecisionAsync(returnCase.Id);

            Assert.IsTrue(detailedDecision.Authentication.OTP.Status == Enums.OTPStatus.Offered);

            DigitalAuthenticationResult auth = GenerateDigitalAuthenticationResult();
            var checkAuthenticationResult    = await ApiClient.PostOtpAsync(returnCase.Id, auth.OTP);

            Assert.IsTrue(checkAuthenticationResult.Status == Enums.OTPStatus.InProgress);

            // if you want this to pass then change the passcode to the code received from the sms
            var verificationCode = new OTPResult()
            {
                Passcode = "1234", Timestamp = DateTime.Now
            };
            var checkPasswordDigitalAuthenticationResult = await ApiClient.PutOtpAsync(returnCase.Id, verificationCode);

            Assert.IsTrue(checkPasswordDigitalAuthenticationResult.Status == Enums.OTPStatus.Fail);
        }