예제 #1
0
            public void should_return_empty_if_not_defined()
            {
                RequestRepositoryMock.SetupGet <string>(s => s.RawUrl).Returns("http://inet.kk570.com/appstores/updatelist");
                this.Context = new SignatureContext(RequestRepositoryMock.Object);

                Assert.Equal(string.Empty, this.Context.ClientSignature);
            }
예제 #2
0
            public void should_remove_sign_itself_and_ignore_sign_case()
            {
                RequestRepositoryMock.SetupGet <string>(s => s.RawUrl).Returns("http://inet.kk570.com/appstores/updatelist?imsi=343434343&SIGN=fafafafadfa&sign_type=2&app_type=yl");

                this.Context = new SignatureContext(RequestRepositoryMock.Object);

                Assert.NotEmpty(this.Context.SortedQuery);
                Assert.False(this.Context.SortedQuery.AllKeys.Contains("SIGN"));
                Assert.Equal(this.Context.Query.AllKeys.Count() - 1, this.Context.SortedQuery.AllKeys.Count());
            }
예제 #3
0
            public void should_remove_sign_itself()
            {
                RequestRepositoryMock.SetupGet <string>(s => s.RawUrl).Returns(DEFAULT_URL);

                this.Context = new SignatureContext(RequestRepositoryMock.Object);

                Assert.NotEmpty(this.Context.SortedQuery);
                Assert.False(this.Context.SortedQuery.AllKeys.Contains("sign"));
                Assert.Equal(this.Context.Query.AllKeys.Count() - 1, this.Context.SortedQuery.AllKeys.Count());
            }
예제 #4
0
            public void build_normal()
            {
                RequestRepositoryMock.SetupGet <string>(s => s.RawUrl).Returns(DEFAULT_URL);
                this.Context = new SignatureContext(RequestRepositoryMock.Object);


                Assert.Equal(DEFAULT_URL, this.Context.Url);
                Assert.Equal(SignatureMethod.HMAC_SHA1, this.Context.Method);
                Assert.Equal("4c6f1851f6a7496c86ffac67540ae9f5", this.Context.Secret);
                Assert.NotEmpty(this.Context.Query);
                Assert.Equal("9460009830450729", this.Context.Query["imsi"]);
                Assert.Equal("dsfafjoai34343dsfa", this.Context.ClientSignature);
            }