public Fixture Then_the_signature_is(string expected) { string actual = new HmacSha1().Sign(_signatureBaseString, _consumerSecret, _tokenSecret); return new YesNoFixture(expected == actual, "Invalid signature. Expected [" + expected + "]. Got [" + actual + "].", 2 ); }
public Fixture Then_we_can_connect() { var oAuthParameters = new OAuthParameters( _consumer.ConsumerKey, new TokenKey(string.Empty), "HMAC-SHA1", new DefaultTimestampSequence(), new DefaultNonceSequence(), string.Empty, "1.0" ); var signatureBaseString = new SignatureBaseString( new Request { Url = new Uri("https://api.twitter.com/oauth/request_token"), Verb = "GET" }, oAuthParameters ); var signature = new HmacSha1().Sign(signatureBaseString.Value, _consumer.Secret, null); oAuthParameters.SetSignature(signature); var header = new AuthorizationHeader(oAuthParameters, string.Empty); var req = (HttpWebRequest)WebRequest.Create("https://api.twitter.com/oauth/request_token"); req.Headers.Add("Authorization", header.Value); var response = TInternet.Get(req); const HttpStatusCode expected = HttpStatusCode.OK; var actual = response.StatusCode; return new YesNoFixture(actual == expected, "Expected [" + expected +"]. Got [" + actual+ "]", 2); }