Example #1
0
        public void TryGetValidHeaderShouldReturnIt()
        {
            HttpHeader httpHeader = new HttpHeader("name", "pesho");

            HttpHeaderCollection headerCollection = new HttpHeaderCollection();

            headerCollection.Add(httpHeader);

            Assert.Equal <HttpHeader>(httpHeader, headerCollection.GetHeader(httpHeader.Key));
        }
Example #2
0
        public void TryGetInvalidHeaderShouldReturnNull()
        {
            HttpHeader httpHeader = new HttpHeader("name", "pesho");

            HttpHeaderCollection headerCollection = new HttpHeaderCollection();

            headerCollection.Add(httpHeader);

            Assert.Null(headerCollection.GetHeader("age"));
        }
Example #3
0
        public void TryGetHeaderWithoutKeyShouldThrowException()
        {
            HttpHeader httpHeader = new HttpHeader("name", "pesho");

            HttpHeaderCollection headerCollection = new HttpHeaderCollection();

            headerCollection.Add(httpHeader);

            Assert.Throws <BadRequestException>(() => headerCollection.GetHeader(string.Empty));
        }