public void GetAsync_RetrievedTokenIsInvalid_Throws()
        {
            _tokenResponseValidatorMock.Setup(x => x.IsValid(It.IsAny <AssertionModel>())).Returns(false);

            Func <Task> act = () => _sut.GetAsync("random");

            act.Should().Throw <UnsuccessfulResponseException>();
        }
Ejemplo n.º 2
0
        public async Task SendsValidRequest_ExpectsTrustedList()
        {
            var accessToken = await GetAccessTokenAsync();

            var trustedList = await _sut.GetAsync(accessToken);

            trustedList.Should().NotBeNull();
            trustedList.Should().HaveCountGreaterThan(0);
        }
Ejemplo n.º 3
0
        private async Task <bool> IsRootCertificateTrusted(
            X509Certificate2 certificate,
            string accessToken,
            CancellationToken cancellationToken)
        {
            var trustedList = await _trustedListQueryService.GetAsync(accessToken, cancellationToken);

            var fingerprint = certificate.GetSha256();

            return(trustedList.Any(x => x.CertificateFingerprint == fingerprint));
        }