Esempio n. 1
0
        public void query_string_is_empty()
        {
            var mockRequestRepository = new Mock<IRequestRepository>();

            mockRequestRepository.SetupGet<string>(s => s.RawUrl).Returns("http://localhost:11944/Misc/EncUtil");

            var context = new SignatureContext(mockRequestRepository.Object, Encoding.UTF8);

            var sha1 = new SHA1Signature();
            var ret = sha1.Sign(context);

            Assert.NotEqual("b6a59234783b8ed4afd1cd5d4230bbe0c6de13dd", ret);
        }
Esempio n. 2
0
        public void should_equal_with_snda_result()
        {
            var mockRequestRepository = new Mock<IRequestRepository>();

            mockRequestRepository.SetupGet<string>(s => s.RawUrl).Returns(DEFAULT_URL);

            var context = new SignatureContext(mockRequestRepository.Object, Encoding.UTF8);

            var sha1 = new SHA1Signature();
            var ret = sha1.Sign(context);

            Assert.Equal("53ed4585d50783c4fa1a0f5605a299622494169f", ret);
        }
Esempio n. 3
0
        public static ISignature GetSignature(SignatureMethod method)
        {
            var sig = default(ISignature);
            switch (method)
            {
                case SignatureMethod.HMAC_SHA1:
                    sig= new SHA1Signature();
                    break;
                case SignatureMethod.MD5:
                default:
                    sig= new MD5Signature();
                    break;
            }

            return sig;
        }