public void TryGetValidHeaderShouldReturnIt() { HttpHeader httpHeader = new HttpHeader("name", "pesho"); HttpHeaderCollection headerCollection = new HttpHeaderCollection(); headerCollection.Add(httpHeader); Assert.Equal <HttpHeader>(httpHeader, headerCollection.GetHeader(httpHeader.Key)); }
public void TryGetInvalidHeaderShouldReturnNull() { HttpHeader httpHeader = new HttpHeader("name", "pesho"); HttpHeaderCollection headerCollection = new HttpHeaderCollection(); headerCollection.Add(httpHeader); Assert.Null(headerCollection.GetHeader("age")); }
public void TryGetHeaderWithoutKeyShouldThrowException() { HttpHeader httpHeader = new HttpHeader("name", "pesho"); HttpHeaderCollection headerCollection = new HttpHeaderCollection(); headerCollection.Add(httpHeader); Assert.Throws <BadRequestException>(() => headerCollection.GetHeader(string.Empty)); }