Пример #1
0
        public void SetShouldOverWritePreviousValue()
        {
            TestDefaultHeaders headers = NewInstance();

            headers.Set(Of("name"), Of("value1"));
            headers.Set(Of("name"), Of("value2"));
            Assert.Equal(1, headers.Size);
            Assert.Equal(1, headers.GetAll(Of("name")).Count);
            Assert.Equal(Of("value2"), headers.GetAll(Of("name"))[0]);
            Assert.True(headers.TryGet(Of("name"), out ICharSequence value));
            Assert.Equal(Of("value2"), value);
        }
Пример #2
0
        public void MultipleValuesPerNameShouldBeAllowed()
        {
            TestDefaultHeaders headers = NewInstance();

            headers.Add(Of("name"), Of("value1"));
            headers.Add(Of("name"), Of("value2"));
            headers.Add(Of("name"), Of("value3"));
            Assert.Equal(3, headers.Size);

            IList <ICharSequence> values = headers.GetAll(Of("name"));

            Assert.Equal(3, values.Count);
            Assert.True(values.Contains(Of("value1")));
            Assert.True(values.Contains(Of("value2")));
            Assert.True(values.Contains(Of("value3")));
        }
Пример #3
0
        public void GetAllReturnsEmptyListForUnknownName()
        {
            TestDefaultHeaders headers = NewInstance();

            Assert.Equal(0, headers.GetAll(Of("noname")).Count);
        }