コード例 #1
0
        private static void AssertSignedRequest(string id, string secret, string expected)
        {
            var credentials = new StaticCredentials(id, secret);
            var request     = new Request("https://us-street.api.smartystreets.com/street-address");

            credentials.Sign(request);

            Assert.AreEqual(expected, request.GetUrl());
        }
コード例 #2
0
        public void TestResponseReturnedCorrectly()
        {
            var signer           = new StaticCredentials("id", "secret");
            var expectedResponse = new Response(200, null);
            var mockSender       = new MockSender(expectedResponse);
            var sender           = new SigningSender(signer, mockSender);

            var actualResponse = sender.Send(new Request("http://localhost/"));

            Assert.AreEqual(expectedResponse, actualResponse);
        }
コード例 #3
0
        public void TestSigningOfRequest()
        {
            var signer     = new StaticCredentials("id", "secret");
            var mockSender = new MockSender(null);
            var sender     = new SigningSender(signer, mockSender);

            sender.Send(new Request("http://localhost/"));

            var url = mockSender.Request.GetUrl();

            Assert.AreEqual("http://localhost/?auth-id=id&auth-token=secret", url);
        }
コード例 #4
0
 public void SetUp()
 {
     signer = new StaticCredentials("id", "secret");
 }