Esempio n. 1
0
        public void SignUri_WhenCalled_ShouldReturnUriWithTheApiKey()
        {
            //arrange
            var sut = new UriSignedConstructor(new SignatureConstructor(), new SignatureHasher(_secretKey), _apiKey);


            //act
            var actual = sut.SignUri(_uri, _now).ToString();

            //assert
            actual.Should(Be.StringContaining("apikey=" + _apiKey));
        }
Esempio n. 2
0
        public void SignUri_WhenCalled_ShouldReturnUriWithSignature()
        {
            //arrange
            var hasher = new SignatureHasher(_secretKey);
            var signatureConstructor = new SignatureConstructor();

            var sut = new UriSignedConstructor(signatureConstructor, hasher, _apiKey);

            //act
            var actual = sut.SignUri(_uri, _now).ToString();

            //assert
            var sigValue = WebUtility.UrlEncode(hasher.Hash(signatureConstructor.BuildSignature(_uri, _now)));

            actual.Should(Be.StringContaining("sig=" + sigValue));
        }
Esempio n. 3
0
 public Client(UriSignedConstructor uriSignedConstructor)
 {
     _uriSignedConstructor = uriSignedConstructor;
 }
Esempio n. 4
0
        public Client(UriSignedConstructor uriSignedConstructor)
        {
            _uriSignedConstructor = uriSignedConstructor;

        }