示例#1
0
        public void PublishCard_Should_RaiseExceptionIfTokenSignedByWrongKey()
        {
            var identity = faker.Random.AlphaNumeric(15);
            var jwt      = JwtSignedByWrongApiKey(identity);
            var client   = new CardClient(AppSettings.CardsServiceAddress);

            Assert.ThrowsAsync <ClientException>(
                async() => await client.PublishCardAsync(GenerateRawSignedModel(identity), jwt.ToString()));
        }
示例#2
0
        public void PublishCard_Should_RaiseExceptionIfTokenIdentityDiffersFromModelIdentity()
        {
            var jwt = GenerateJwt(
                faker.Random.AlphaNumeric(15),
                (PrivateKey)IntegrationHelper.ApiPrivateKey(),
                AppSettings.ApiPublicKeyId
                );
            var client = new CardClient(AppSettings.CardsServiceAddress);

            Assert.ThrowsAsync <ClientException>(
                async() => await client.PublishCardAsync(
                    GenerateRawSignedModel(faker.Random.AlphaNumeric(15)),
                    jwt.ToString())
                );
        }