public HttpWebResponseTest CreateResponse(HttpStatusCode responseStatus = HttpStatusCode.OK, String statusDescription = "OK", WebHeaderCollection responseHeaders = null) { SerializationInfo si = new SerializationInfo(typeof(HttpWebResponse), new System.Runtime.Serialization.FormatterConverter()); StreamingContext sc = new StreamingContext(); si.AddValue("m_HttpResponseHeaders", responseHeaders ?? new WebHeaderCollection { }); si.AddValue("m_Uri", this.itemUri); si.AddValue("m_Certificate", null); si.AddValue("m_Version", HttpVersion.Version11); si.AddValue("m_StatusCode", responseStatus); si.AddValue("m_ContentLength", 0); si.AddValue("m_Verb", this.Method); si.AddValue("m_StatusDescription", statusDescription); si.AddValue("m_MediaType", null); HttpWebResponseTest response = new HttpWebResponseTest(si, sc); return(response); }
public HttpWebResponseTest CreateResponse(HttpStatusCode responseStatus = HttpStatusCode.OK, String statusDescription = "OK", WebHeaderCollection responseHeaders = null) { SerializationInfo si = new SerializationInfo(typeof(HttpWebResponse), new System.Runtime.Serialization.FormatterConverter()); StreamingContext sc = new StreamingContext(); si.AddValue("m_HttpResponseHeaders", responseHeaders ?? new WebHeaderCollection { }); si.AddValue("m_Uri", this.itemUri); si.AddValue("m_Certificate", null); si.AddValue("m_Version", HttpVersion.Version11); si.AddValue("m_StatusCode", responseStatus); si.AddValue("m_ContentLength", 0); si.AddValue("m_Verb", this.Method); si.AddValue("m_StatusDescription", statusDescription); si.AddValue("m_MediaType", null); HttpWebResponseTest response = new HttpWebResponseTest(si, sc); return response; }