public void CanAddHeaders() { var headers = new HttpHeadersAbstraction(); headers.Add("Test", "Value"); Assert.IsTrue(headers.Contains("Test")); Assert.AreEqual("Value", headers["Test"].First()); }
public void CanClearHeaders() { var headers = new HttpHeadersAbstraction(); headers.Add("Test", "Value"); Assert.IsTrue(headers.Contains("Test")); headers.Clear(); Assert.AreEqual(0, headers.Count()); }
public static IHttpResponseAbstraction CreateResponse(HttpStatusCode code, IEnumerable <KeyValuePair <string, string> > headers, Stream content) { var abstractionHeaders = new HttpHeadersAbstraction(); foreach (var header in headers) { abstractionHeaders.Add(header.Key, header.Value); } return(new HttpResponseAbstraction(content, abstractionHeaders, code)); }
public void CanGetValuesHeaders() { var headers = new HttpHeadersAbstraction(); var values = new List <string>() { "value1", "value2" }; headers.Add("Test", values); Assert.IsTrue(headers.Contains("Test")); Assert.AreEqual(values, headers.GetValues("Test")); }
public void CanTryGetValuesHeaders() { var headers = new HttpHeadersAbstraction(); var values = new List <string>() { "value1", "value2" }; headers.Add("Test", values); IEnumerable <string> resValues = new List <string>(); Assert.IsTrue(headers.TryGetValue("Test", out resValues)); Assert.AreEqual(2, resValues.Count()); Assert.AreEqual(values, resValues); }