コード例 #1
0
        private ISender BuildSender()
        {
            if (this.httpSender != null)
            {
                return(this.httpSender);
            }

            ISender sender = new NativeSender(this.maxTimeout, this.proxy);

            sender = new StatusCodeSender(sender);

            if (this.customHeaders != null)
            {
                sender = new CustomHeaderSender(this.customHeaders, sender);
            }

            if (this.signer != null)
            {
                sender = new SigningSender(this.signer, sender);
            }

            sender = new URLPrefixSender(this.urlPrefix, sender);

            if (this.maxRetries > 0)
            {
                sender = new RetrySender(this.maxRetries, sender);
            }

            sender = new LicenseSender(this.licenses, sender);

            return(sender);
        }
コード例 #2
0
        public void TestLicensesNotAdded()
        {
            var mockSender      = new MockSender(null);
            var urlPrefixSender = new URLPrefixSender("http://localhost/", mockSender);
            var sender          = new LicenseSender(new List <string>(), urlPrefixSender);

            sender.Send(new Request());

            Assert.False(mockSender.Request.GetUrl().Contains("license="));
        }
コード例 #3
0
        public void TestAddingLicenses()
        {
            var licenses = new List <string> {
                "one",
                "two",
                "three"
            };

            var mockSender      = new MockSender(null);
            var urlPrefixSender = new URLPrefixSender("http://localhost/", mockSender);
            var sender          = new LicenseSender(licenses, urlPrefixSender);

            sender.Send(new Request());

            Assert.AreEqual("license=one%2Ctwo%2Cthree", mockSender.Request.GetUrl().Split("?")[1]);
        }