public void GetHeaderValueMaxLenTruncatesEndInvalid(int maxLength) { WebHeaderCollection headers = new WebHeaderCollection { [W3CConstants.TraceStateHeader] = "k1=v1,k2=v2" }; var values = headers.GetHeaderValue(W3CConstants.TraceStateHeader, maxLength)?.ToList(); Assert.IsNull(values); }
private void GetHeaderValueMaxLenTruncatesEndInvalid(int maxLength) { WebHeaderCollection headers = new WebHeaderCollection { ["header"] = "k1=v1,k2=v2" }; var values = headers.GetHeaderValue("header", maxLength)?.ToList(); Assert.IsNull(values); }
public void GetHeaderValueMaxItemsTruncatesEnd() { WebHeaderCollection headers = new WebHeaderCollection { [W3CConstants.TraceStateHeader] = "k1=v1,k2=v2,k3=v3,k4=v4" }; var values = headers.GetHeaderValue(W3CConstants.TraceStateHeader, 100500, 2)?.ToList(); Assert.IsNotNull(values); Assert.AreEqual(2, values.Count); Assert.AreEqual("k1=v1", values.First()); Assert.AreEqual("k2=v2", values.Last()); }
public void GetHeaderValueNoMax() { WebHeaderCollection headers = new WebHeaderCollection { [W3CConstants.TraceStateHeader] = "k1=v1,k2=v2" }; var values = headers.GetHeaderValue(W3CConstants.TraceStateHeader)?.ToList(); Assert.IsNotNull(values); Assert.AreEqual(2, values.Count); Assert.AreEqual("k1=v1", values.First()); Assert.AreEqual("k2=v2", values.Last()); }