Exemplo 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 md5 = new MD5Signature();
            var ret = md5.Sign(context);

            Assert.Equal("d41d8cd98f00b204e9800998ecf8427e", ret);
        }
Exemplo n.º 2
0
        public void should_equal_with_online_internet()
        {
            var mockRequestRepository = new Mock<IRequestRepository>();

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

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

            var md5 = new MD5Signature();
            var ret = md5.Sign(context);

            Assert.Equal("e78ea96fcecd4a3df8ddf9d776246e6a", ret);
        }
Exemplo 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;
        }