예제 #1
0
        public void SetHeaderKeyValueWithMultipleMatchingHeaderNamesAndMultipleMatchingKeyNames()
        {
            HttpHeaders headers = CreateHeaders();

            headers.Add("HEADER_NAME", "A=a");
            headers.Add("HEADER_NAME", "B=b");
            headers.Add("HEADER_NAME", "C=c1");
            headers.Add("HEADER_NAME", "C=c2");
            HttpHeadersUtilities.SetHeaderKeyValue(headers, "HEADER_NAME", "C", "c3");
            EnumerableAssert.AreEqual(new[] { "A=a", "B=b", "C=c3" }, HttpHeadersUtilities.GetHeaderValues(headers, "HEADER_NAME"));
        }
예제 #2
0
        public void SetHeaderKeyValueWithMultipleMatchingHeaderNamesButOnlyOneMatchingKeyName()
        {
            HttpHeaders headers = CreateHeaders();

            headers.Add("HEADER_NAME", "A=a1");
            headers.Add("HEADER_NAME", "B=b1");
            headers.Add("HEADER_NAME", "C=c1");
            HttpHeadersUtilities.SetHeaderKeyValue(headers, "HEADER_NAME", "B", "b2");
            EnumerableAssert.AreEqual(new[] { "A=a1", "C=c1", "B=b2" }, HttpHeadersUtilities.GetHeaderValues(headers, "HEADER_NAME"));
            Assert.IsTrue(HttpHeadersUtilities.ContainsHeaderKeyValue(headers, "HEADER_NAME", "B"));
        }
예제 #3
0
        public void GetHeaderValuesWithEmptyHeaders()
        {
            HttpHeaders headers = CreateHeaders();

            EnumerableAssert.AreEqual(Enumerable.Empty <string>(), HttpHeadersUtilities.GetHeaderValues(headers, "MOCK_HEADER_NAME"));
        }
예제 #4
0
 public void GetHeaderValuesWithNullHeaders()
 {
     EnumerableAssert.AreEqual(Enumerable.Empty <string>(), HttpHeadersUtilities.GetHeaderValues(null, "MOCK_HEADER_NAME"));
 }