public void BuildSignature_WhenCalled_ShouldStartWithRfc2822Date() { //arrange var sut = new SignatureConstructor(); //act var actual = sut.BuildSignature(url, now); //assert actual.Should(Be.StringStarting("Thu, 01 Jan 2015 12:00:00+0000")); }
public void BuildSignature_WhenCalled_ShouldEndWithApplicationType() { //arrange var sut = new SignatureConstructor(); //act var actual = sut.BuildSignature(url, now); //assert actual.Should(Be.StringEnding("application/json; version=1")); }
public void BuildSignature_WhenCalled_ShouldStartWithRfc2822Date() { //arrange var sut = new SignatureConstructor(); //act var actual = sut.BuildSignature(url, now); //assert actual.Should(Be.StringStarting("Thu, 01 Jan 2015 12:00:00+0000")); }
public void BuildSignature_WhenCalled_ShouldHaveTwoCarriageReturnsAfterTheRfc2822Date() { //arrange var sut = new SignatureConstructor(); //act var actual = sut.BuildSignature(url, now); //assert var subString = actual.Substring(now.ToRfc2822Date(timeZoneInfo).Length); subString.Should(Be.StringStarting("\n\n")); }
public void BuildSignature_WhenCalled_ShouldEndWithApplicationType() { //arrange var sut = new SignatureConstructor(); //act var actual = sut.BuildSignature(url, now); //assert actual.Should(Be.StringEnding("application/json; version=1")); }
public void BuildSignature_WhenCalled_ShouldHaveTwoCarriageReturnsAfterTheRfc2822Date() { //arrange var sut = new SignatureConstructor(); //act var actual = sut.BuildSignature(url, now); //assert var subString = actual.Substring(now.ToRfc2822Date(timeZoneInfo).Length); subString.Should(Be.StringStarting("\n\n")); }
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)); }
public UriSignedConstructor(SignatureConstructor signatureConstructor, SignatureHasher signatureHasher, string apiKey) { _apiKey = apiKey; _signatureConstructor = signatureConstructor; _signatureHasher = signatureHasher; }
public UriSignedConstructor(SignatureConstructor signatureConstructor,SignatureHasher signatureHasher,string apiKey) { _apiKey = apiKey; _signatureConstructor = signatureConstructor; _signatureHasher = signatureHasher; }