コード例 #1
0
        public static HttpHeaders GetSampleStatsRequestHeaders()
        {
            var headers = new TestHttpHeaders();

            headers.Add("Link", string.Format("<./stats{0}>; rel=\"first\"", FirstQueryString));
            headers.Add("Link", string.Format("<./stats{0}>; rel=\"next\"", NextQueryString));
            return(headers);
        }
コード例 #2
0
        public static HttpHeaders GetSampleHistoryRequestHeaders()
        {
            var headers = new TestHttpHeaders();

            headers.Add("Link", string.Format("<./history{0}>; rel=\"first\"", FirstQueryString));
            headers.Add("Link", string.Format("<./history{0}>; rel=\"next\"", NextQueryString));
            headers.Add("Link", string.Format("<./history{0}>; rel=\"current\"", CurrentQueryString));
            return(headers);
        }
        public void VerifyHeaderGetValues()
        {
            // setup
            var headers = new TestHttpHeaders();

            headers.Add(HeaderName, "one");
            headers.Add(HeaderName, "two");
            headers.Add(HeaderName, "three");

            // assert
            var result = headers.GetValueSafe(HeaderName);

            Assert.AreEqual("one", result);

            var result2 = headers.GetValueSafe(FakeHeaderName);

            Assert.AreEqual(default(string), result2);
        }
        public void VerifyInvalidHeadersLengthIsProtected()
        {
            // setup
            var headers = new TestHttpHeaders();

            headers.Add(HeaderName, new string('*', QuickPulseResponseHeaderHeaderMaxLength + 1));

            // assert
            var result = headers.GetValueSafe(HeaderName);

            Assert.AreEqual(QuickPulseResponseHeaderHeaderMaxLength, result.Length);
        }
        public void VerifyHeaderGetValue()
        {
            // setup
            var headers = new TestHttpHeaders();

            foreach (string headerName in QuickPulseConstants.XMsQpsAuthOpaqueHeaderNames)
            {
                headers.Add(headerName, headerName + SecretString);
            }

            // assert
            foreach (string headerName in QuickPulseConstants.XMsQpsAuthOpaqueHeaderNames)
            {
                var value = headers.GetValueSafe(headerName);
                Assert.AreEqual(headerName + SecretString, value);
            }
        }