Ejemplo n.º 1
0
        public void GetHeaderKeyValuesWithMatchingHeader()
        {
            HttpHeaders headers = CreateHeaders();

            headers.Add("HEADER_NAME", "KEY_NAME=KEY_VALUE");
            Assert.AreEqual("KEY_VALUE", HttpHeadersUtilities.GetHeaderKeyValue(headers, "HEADER_NAME", "KEY_NAME"));
        }
Ejemplo n.º 2
0
        public void SetHeaderKeyValueWithEmptyHeaders()
        {
            HttpHeaders headers = CreateHeaders();

            HttpHeadersUtilities.SetHeaderKeyValue(headers, "HEADER_NAME", "KEY_NAME", "KEY_VALUE");
            Assert.AreEqual("KEY_VALUE", HttpHeadersUtilities.GetHeaderKeyValue(headers, "HEADER_NAME", "KEY_NAME"));
        }
Ejemplo n.º 3
0
        public void GetHeaderKeyValuesWithMultipleMatchingHeaderNamesButOnlyOneMatchingKeyName()
        {
            HttpHeaders headers = CreateHeaders();

            headers.Add("HEADER_NAME", "A=a");
            headers.Add("HEADER_NAME", "B=b");
            headers.Add("HEADER_NAME", "C=c");
            Assert.AreEqual("b", HttpHeadersUtilities.GetHeaderKeyValue(headers, "HEADER_NAME", "B"));
        }
Ejemplo n.º 4
0
        public void GetHeaderKeyValueShouldReturnValue()
        {
            IHeaderDictionary headerDictionary = new HeaderDictionary(
                new Dictionary <string, StringValues>()
            {
                { "HeaderName", new StringValues("app=id") },
                { "NoizyName", new StringValues("noizy=noizy-id") }
            });

            string actual = HttpHeadersUtilities.GetHeaderKeyValue(headerDictionary, "HeaderName", "app");

            Assert.Equal("id", actual);
        }
Ejemplo n.º 5
0
        public void GetHeaderKeyValuesWithEmptyHeaders()
        {
            HttpHeaders headers = CreateHeaders();

            Assert.AreEqual(null, HttpHeadersUtilities.GetHeaderKeyValue(headers, "HEADER_NAME", "KEY_NAME"));
        }
Ejemplo n.º 6
0
 public void GetHeaderKeyValuesWithNullHeaders()
 {
     Assert.AreEqual(null, HttpHeadersUtilities.GetHeaderKeyValue(null, "HEADER_NAME", "KEY_NAME"));
 }