/// <summary> /// 构造方法 /// </summary> public HttpOption() { _method = "GET"; Format = SerializeFormat.Form; ContentType = "application/x-www-form-urlencoded"; Headers = new HttpHeaderCollection(); }
public HttpResponse() { Content = new byte[0]; Cookies = new HttpCookieCollection(); Enumerator = new EnumerationService(); Headers = new HttpHeaderCollection(); }
public void Add_HeaderIsRepeating_AddsSameHeader() { // Arrange var headers = new HttpHeaderCollection(_initialHeaders); // Act var sameHeader = new HttpHeader(headers.ElementAt(0).Name, headers.ElementAt(0).Value); headers.Add(sameHeader); // Assert Assert.That(headers.Count(), Is.EqualTo(7)); Assert.That(headers.Last(), Is.SameAs(sameHeader)); var headersString = headers.ToString(); Assert.That(headersString, Is.EqualTo(@"Accept: text/html, application/xhtml+xml, image/jxr, */* Accept-Language: ru-RU User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299 Accept-Encoding: gzip, deflate Host: allitebooks.com Connection: Keep-Alive Accept: text/html, application/xhtml+xml, image/jxr, */* ")); var binary = headers.ToArray(); Assert.That(binary, Is.EquivalentTo(headersString.ToAsciiBytes())); }
public void HttpHeaderCollection_Get() { HttpHeaderCollection headers; DateTime date1 = new DateTime(2005, 11, 5, 11, 54, 15); DateTime date2 = new DateTime(2005, 11, 6, 11, 54, 15); headers = new HttpHeaderCollection("GET", "/foo.htm"); headers.Add("String", "Hello World!"); headers.Add("Int", "10"); headers.Add("Date", "Sat, 05 Nov 2005 11:54:15 GMT"); Assert.AreEqual("Hello World!", headers.Get("string", null)); Assert.AreEqual("Hello World!", headers.Get("STRING", null)); Assert.AreEqual("foobar", headers.Get("Foobar", "foobar")); Assert.IsNull(headers.Get("Foobar", null)); Assert.AreEqual(10, headers.Get("int", 0)); Assert.AreEqual(10, headers.Get("INT", 0)); Assert.AreEqual(77, headers.Get("Foo", 77)); Assert.AreEqual(88, headers.Get("String", 88)); Assert.AreEqual(date1, headers.Get("date", DateTime.MinValue)); Assert.AreEqual(date1, headers.Get("DATE", DateTime.MinValue)); Assert.AreEqual(date2, headers.Get("foo", date2)); Assert.AreEqual(date2, headers.Get("string", date2)); }
public HttpResponse(HttpResponseStatusCode statusCode) { Cookies = new HttpCookieCollection(); Headers = new HttpHeaderCollection(); Content = new byte[0]; StatusCode = statusCode; }
public static bool GetRequiresContinue(this HttpHeaderCollection headers) { string value; return(headers.TryGetValue(HttpHeaderNames.Expect, out value) && string.Equals(value, "100-Continue", StringComparison.OrdinalIgnoreCase)); }
public HttpRequest(string requestString) { FormData = new Dictionary <string, object>(); QueryData = new Dictionary <string, object>(); Headers = new HttpHeaderCollection(); ParseRequest(requestString); }
protected QueryExpression ResolveExpressionAndGetResponse(QueryExpression expression, out Contracts.OData.ODataRequest request, out Contracts.OData.ODataResponse response) { ExceptionUtilities.CheckArgumentNotNull(expression, "expression"); ExceptionUtilities.CheckAllRequiredDependencies(this); expression = this.QueryResolver.Resolve(expression); var uri = this.ProtocolTestServices.QueryToUriConverter.GenerateUriFromQuery(expression, this.ServiceRoot); var headers = new HttpHeaderCollection(); headers.Accept = DetermineAcceptType(uri, this.DefaultAcceptType); if (this.DataServiceVersion != DataServiceProtocolVersion.Unspecified) { headers.DataServiceVersion = this.DataServiceVersion.ConvertToHeaderFormat(); } if (this.MaxDataServiceVersion != DataServiceProtocolVersion.Unspecified) { headers.MaxDataServiceVersion = this.MaxDataServiceVersion.ConvertToHeaderFormat(); } SetupProtocolRequest(expression, this.ProtocolTestServices.RequestManager, this.QueryToODataPayloadConverter, uri, headers, this.GetActionContentType(), out request); response = this.GetResponse(expression, request); return(expression); }
public static bool GetHasBodyContent(this HttpHeaderCollection headers) { string value; return(headers.TryGetValue(HttpHeaderNames.ContentLength, out value) && !string.Equals(value, "0", StringComparison.OrdinalIgnoreCase)); }
/// <summary> /// 构造方法 /// </summary> public HttpOption() { _method = "GET"; Format = SerializeFormat.FORM; ContentType = "application/x-www-form-urlencoded"; Headers = new HttpHeaderCollection(); }
internal HttpResponse() { Version = HttpVersions.Http11; Headers = new HttpHeaderCollection(); SetStatus(HttpStatusCode.NotFound); Content = new byte[0]; }
/// <summary> /// Initializes a new instance of the <see cref="UnlockParameters"/> class. /// <param name="lockToken">The resource lock token.</param> /// </summary> public UnlockParameters(string lockToken) { Guard.NotNull(lockToken, "lockToken"); LockToken = lockToken; Headers = new HttpHeaderCollection(); }
public void opImplicit_HttpHeaderCollection_stringEmpty() { var expected = new HttpHeaderCollection(); HttpHeaderCollection actual = string.Empty; Assert.Equal(expected, actual); }
public static bool GetConnectionMustBeClosed(this HttpHeaderCollection headers) { string value; return(headers.TryGetValue(HttpHeaderNames.Connection, out value) && string.Equals(value, "Close", StringComparison.OrdinalIgnoreCase)); }
Connection: Keep-Alive")] // no CRLF at all public void Parse_InputIsValid_ThrowsBadHttpDataException(string input) { // Arrange var buffer = input.ToAsciiBytes(); // Act & Assert Assert.Throws <BadHttpDataException>(() => HttpHeaderCollection.Parse(buffer, 3)); }
public void AddHeaderWithEmptyValueShouldThrowException() { HttpHeader httpHeader = new HttpHeader("name", string.Empty); HttpHeaderCollection headerCollection = new HttpHeaderCollection(); Assert.Throws <BadRequestException>(() => headerCollection.Add(httpHeader)); }
public void AddHeaderWithEmptyKeyShouldThrowException() { HttpHeader httpHeader = new HttpHeader(string.Empty, "pesho"); HttpHeaderCollection headerCollection = new HttpHeaderCollection(); Assert.Throws <BadRequestException>(() => headerCollection.Add(httpHeader)); }
public HttpResponse(HttpResponseStatusCode statusCode) { CoreValidator.ThrowIfNull(statusCode, nameof(statusCode)); Headers = new HttpHeaderCollection(); Cookies = new HttpCookieCollection(); Content = new byte[0]; StatusCode = statusCode; }
public void opIndexer_string() { var obj = new HttpHeaderCollection { new HttpHeader("name", "value") }; Assert.Equal("value", obj["name"]); }
public void Parse_BufferIsNull_ThrowsArgumentNullException(int start) { // Arrange // Act & Assert var ex = Assert.Throws <ArgumentNullException>(() => HttpHeaderCollection.Parse(null, start)); Assert.That(ex.ParamName, Is.EqualTo("buffer")); }
public void Parse_StartIsOutOfRange_ThrowsArgumentOutOfRangeException(int start) { // Arrange // Act & Assert var ex = Assert.Throws <ArgumentOutOfRangeException>(() => HttpHeaderCollection.Parse(new byte[10], start)); Assert.That(ex.ParamName, Is.EqualTo("start")); }
public void ContansName_ArgumentIsNull_ThrowsArgumentNullException() { // Arrange var headers = new HttpHeaderCollection(_initialHeaders); // Act & Assert var ex = Assert.Throws <ArgumentNullException>(() => headers.ContainsName(null)); Assert.That(ex.ParamName, Is.EqualTo("name")); }
public void Add_HeaderIsNull_ThrowsArgumentNullException() { // Arrange var headers = new HttpHeaderCollection(_initialHeaders); // Act & Assert var ex = Assert.Throws <ArgumentNullException>(() => headers.Add(null)); Assert.That(ex.ParamName, Is.EqualTo("header")); }
public void TryGetHeaderWithoutKeyShouldThrowException() { HttpHeader httpHeader = new HttpHeader("name", "pesho"); HttpHeaderCollection headerCollection = new HttpHeaderCollection(); headerCollection.Add(httpHeader); Assert.Throws <BadRequestException>(() => headerCollection.GetHeader(string.Empty)); }
public void GetContainedHeaderShouldReturnTrue() { HttpHeader httpHeader = new HttpHeader("name", "pesho"); HttpHeaderCollection headerCollection = new HttpHeaderCollection(); headerCollection.Add(httpHeader); Assert.True(headerCollection.ContainsHeader(httpHeader.Key)); }
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 opImplicit_HttpHeaderCollection_string() { var expected = new HttpHeaderCollection { new HttpHeader("name", "value") }; HttpHeaderCollection actual = "name: value"; Assert.Equal(expected, actual); }
public void HttpHeaderCollection_BasicResponse() { HttpHeaderCollection headers; headers = new HttpHeaderCollection(HttpStatus.OK, "OK"); Assert.IsTrue(headers.IsResponse); Assert.IsFalse(headers.IsRequest); Assert.AreEqual(HttpStatus.OK, headers.Status); Assert.AreEqual("OK", headers.Reason); Assert.AreEqual(HttpStack.Http11, headers.HttpVersion); }
public HttpRequest(string requestString) { CoreValidator.ThrowIfNullOrEmpty(requestString, nameof(requestString)); FormData = new Dictionary <string, object>(); QueryData = new Dictionary <string, object>(); Headers = new HttpHeaderCollection(); Cookies = new HttpCookieCollection(); ParseRequest(requestString); }
public void ContansName_NameIsNotPresent_ReturnsFalse() { // Arrange var headers = new HttpHeaderCollection(_initialHeaders); // Act var contains = headers.ContainsName("Strange-Host"); // Assert Assert.That(contains, Is.False); }
public static bool GetClientSupportsGzipCompression(this HttpHeaderCollection headers) { string headerValue; if (headers.TryGetValue(HttpHeaderNames.AcceptEncoding, out headerValue)) { return(headerValue.IndexOf("gzip", StringComparison.OrdinalIgnoreCase) > -1); } return(false); }
public void IEnumerable_op_GetEnumerator() { var item = new HttpHeader("name", "value"); var obj = new HttpHeaderCollection { item }; var enumerator = (obj as IEnumerable).GetEnumerator(); enumerator.MoveNext(); Assert.Same(item, enumerator.Current); }
/// <summary> /// Initializes a new instance of the <see cref="HttpRequest"/> class. /// </summary> /// <param name="source">The source.</param> internal HttpRequest(IHttpTransaction source) { if (source is HttpClient) this.client = (HttpClient)source; else this.connection = (HttpConnection)source; this.headers = new HttpHeaderCollection(); this.query = new Dictionary<string, string>(); this.version = ""; this.path = ""; }
public void Constructor_ValidArguments_RunsOk() { // Arrange var line = new HttpStatusLine(HttpStatusCode.OK); var headersArray = new[] { new HttpHeader("Server", "nginx/1.8.0"), new HttpHeader("Date", "Fri, 20 Apr 2018 07:15:11 GMT"), new HttpHeader("Content-Type", "text/html; charset=UTF-8"), new HttpHeader("Transfer-Encoding", "chunked"), new HttpHeader("Connection", "keep-alive"), new HttpHeader("Vary", "Accept-Encoding"), new HttpHeader("X-Powered-By", "PHP/5.4.45"), new HttpHeader("X-Pingback", "http://www.allitebooks.com/xmlrpc.php"), }; var headers = new HttpHeaderCollection(headersArray); // Act var responseMetadata = new HttpResponseMetadata(line, headers); // Assert Assert.That(responseMetadata.Line.Version, Is.EqualTo("HTTP/1.1")); Assert.That((int)responseMetadata.Line.Code, Is.EqualTo(200)); Assert.That(responseMetadata.Line.Reason, Is.EqualTo("OK")); Assert.That(responseMetadata.Headers.Count(), Is.EqualTo(8)); Assert.That(responseMetadata.Headers.ElementAt(0), Is.SameAs(headersArray[0])); Assert.That(responseMetadata.Headers.ElementAt(1), Is.SameAs(headersArray[1])); Assert.That(responseMetadata.Headers.ElementAt(2), Is.SameAs(headersArray[2])); Assert.That(responseMetadata.Headers.ElementAt(3), Is.SameAs(headersArray[3])); Assert.That(responseMetadata.Headers.ElementAt(4), Is.SameAs(headersArray[4])); Assert.That(responseMetadata.Headers.ElementAt(5), Is.SameAs(headersArray[5])); var expectedString = @"HTTP/1.1 200 OK Server: nginx/1.8.0 Date: Fri, 20 Apr 2018 07:15:11 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Encoding X-Powered-By: PHP/5.4.45 X-Pingback: http://www.allitebooks.com/xmlrpc.php "; var toString = responseMetadata.ToString(); Assert.That(toString, Is.EqualTo(expectedString)); var bytes = responseMetadata.Serialize(); Assert.That(bytes, Is.EquivalentTo(expectedString.ToAsciiBytes())); }
private void TrackSetSaveStream(DataServiceContextData data, MethodBase methodToTrack, object[] parameterValues) { string name; int streamParameterIndex; bool closeStream; IEnumerable <KeyValuePair <string, string> > headers; // if the second arg is not a string, then it is an MR, in which case null is correct if (methodToTrack.GetParameters()[1].Name == "name") { name = (string)parameterValues[1]; streamParameterIndex = 2; closeStream = (bool)parameterValues[3]; var args = parameterValues[4] as DSClient.DataServiceRequestArgs; if (args == null) { headers = new HttpHeaderCollection() { ContentType = (string)parameterValues[4] }; } else { headers = args.Headers; } } else { name = null; streamParameterIndex = 1; closeStream = (bool)parameterValues[2]; var args = parameterValues[3] as DSClient.DataServiceRequestArgs; if (args == null) { headers = new HttpHeaderCollection() { ContentType = (string)parameterValues[3], Slug = (string)parameterValues[4] }; } else { headers = args.Headers; } } var streamProxy = parameterValues[streamParameterIndex] as IStreamLogger; ExceptionUtilities.CheckObjectNotNull(streamProxy, "Stream was not wrapped by a stream logger"); data.TrackSetSaveStream(parameterValues[0], name, streamProxy, closeStream, headers); }
public void HttpHeaderCollection_BasicRequest() { HttpHeaderCollection headers; headers = new HttpHeaderCollection("GET", "http://foobar.com"); Assert.IsTrue(headers.IsRequest); Assert.IsFalse(headers.IsResponse); Assert.AreEqual("GET", headers.Method); Assert.AreEqual("http://foobar.com", headers.RawUri); Assert.AreEqual(HttpStack.Http11, headers.HttpVersion); headers = new HttpHeaderCollection("put", "http://foobar.com"); Assert.AreEqual("PUT", headers.Method); }
public HttpRequest(HttpMethod method, string uri, string query, HttpHeaderCollection headers, string plainBody, JsonObject jsonBody) { if (uri == null) throw new ArgumentNullException(nameof(uri)); if (headers == null) throw new ArgumentNullException(nameof(headers)); if (plainBody == null) throw new ArgumentNullException(nameof(plainBody)); Method = method; Uri = uri; Query = query; Headers = headers; PlainBody = plainBody; JsonBody = jsonBody; }
public HttpRequest(HttpMethod method, string uri, Version httpVersion, string query, HttpHeaderCollection headers, string body, int binaryBodyLength) { if (uri == null) throw new ArgumentNullException(nameof(uri)); if (headers == null) throw new ArgumentNullException(nameof(headers)); if (body == null) throw new ArgumentNullException(nameof(body)); Method = method; Uri = uri; HttpVersion = httpVersion; Query = query; Headers = headers; Body = body; BinaryBodyLength = binaryBodyLength; }
public void prop_Headers_get() { var expected = new HttpHeaderCollection(); var mock = new Mock<IHttpMessage>(); mock .SetupGet(x => x.Headers) .Returns(expected) .Verifiable(); var actual = mock.Object.Headers; Assert.Same(expected, actual); mock.VerifyAll(); }
/// <summary> /// Initializes a new instance of the <see cref="HttpResponse"/> class. /// </summary> /// <param name="source">The source.</param> internal HttpResponse(IHttpTransaction source) { if (source is HttpClient) this.client = (HttpClient)source; else this.connection = (HttpConnection)source; this.status = HttpStatus.OK; this.buffer = new MemoryStream(); this.headers = new HttpHeaderCollection(); if (source is HttpConnection) { headers["Content-Type"] = "text/html"; headers["X-Frame-Options"] = "deny"; } }
/// <summary> /// Initializes a new instance of <see cref="HttpUrl"/> class. /// </summary> /// <param name="uri">The uniform resource identifier.</param> /// <exception cref="ArgumentException"> /// <para>The protocol supplied by <paramref name="uri"/> is not supported.</para> /// </exception> public HttpUrl(Uri uri) : base(uri) { if (this.Uri.Scheme != "http" && this.Uri.Scheme != "https") { throw new ArgumentException("The protocol is not supported.", "uri"); } this.cookies = new CookieCollection(); this.customHeaders = new HttpHeaderCollection(); this.Referer = String.Empty; this.UserAgent = String.Empty; this.Version = null; this.IgnoreContentLength = false; }
/// <summary> /// Initializes a new instance of <see cref="HttpUrl"/> class. /// </summary> /// <param name="uri">The uniform resource identifier.</param> /// <exception cref="ArgumentException"> /// <para>The protocol supplied by <paramref name="uri"/> is not supported.</para> /// </exception> public HttpUrl(Uri uri) : base(uri) { if (this.Uri.Scheme != "http" && this.Uri.Scheme != "https") { throw new ArgumentException("The protocol is not supported.", "uri"); } this.cookies = new CookieCollection(); this.customHeaders = new HttpHeaderCollection(); this.Version = null; this.IgnoreContentLength = false; this.ServerAuthenticate = false; this.ProxyServerAuthenticate = false; }
public virtual void Read(TextReader reader) { if (null == reader) { throw new ArgumentNullException("reader"); } var headers = new HttpHeaderCollection(); headers.Read(reader); Headers = headers; var contentType = headers.ContentType; if (null != contentType) { Body = ToContent( reader, ServiceLocator.Current.GetInstance<IMediaType>(contentType.MediaType)); } }
public void op_ToString() { var expected = new StringBuilder(); expected.AppendLine("name: value"); var obj = new HttpHeaderCollection { new HttpHeader("name", "value") }; var actual = obj.ToString(); Assert.Equal(expected.ToString(), actual); }
public void op_Equals_object_whenMultiple() { var obj = new HttpHeaderCollection { new HttpHeader("name", "foo"), new HttpHeader("name", "bar") }; Assert.True(HttpHeaderCollection.FromString("name: foo, bar").Equals(obj)); }
public void op_FromString_stringEmpty() { var expected = new HttpHeaderCollection(); var actual = HttpHeaderCollection.FromString(string.Empty); Assert.Equal(expected, actual); }
public void op_FromString_string_whenMultipleLines() { var value = "a" + Environment.NewLine + ' ' + "b" + Environment.NewLine + '\t' + "c"; var expected = new HttpHeaderCollection { new HttpHeader("name", value) }; var actual = HttpHeaderCollection.FromString("name: " + value); Assert.Equal(expected, actual); }
public void op_FromString_string_withLeadingWhiteSpace() { var expected = new HttpHeaderCollection { new HttpHeader("name", "value") }; var actual = HttpHeaderCollection.FromString("name: value"); Assert.Equal(expected, actual); }
protected QueryExpression ResolveExpressionAndGetResponse(QueryExpression expression, out Contracts.OData.ODataRequest request, out Contracts.OData.ODataResponse response) { ExceptionUtilities.CheckArgumentNotNull(expression, "expression"); ExceptionUtilities.CheckAllRequiredDependencies(this); expression = this.QueryResolver.Resolve(expression); var uri = this.ProtocolTestServices.QueryToUriConverter.GenerateUriFromQuery(expression, this.ServiceRoot); var headers = new HttpHeaderCollection(); headers.Accept = DetermineAcceptType(uri, this.DefaultAcceptType); if (this.DataServiceVersion != DataServiceProtocolVersion.Unspecified) { headers.DataServiceVersion = this.DataServiceVersion.ConvertToHeaderFormat(); } if (this.MaxDataServiceVersion != DataServiceProtocolVersion.Unspecified) { headers.MaxDataServiceVersion = this.MaxDataServiceVersion.ConvertToHeaderFormat(); } SetupProtocolRequest(expression, this.ProtocolTestServices.RequestManager, this.QueryToODataPayloadConverter, uri, headers, this.GetActionContentType(), out request); response = this.GetResponse(expression, request); return expression; }
internal static void SetupProtocolRequest(QueryExpression expression, IODataRequestManager requestManager, IQueryToODataPayloadConverter queryToPayloadConverter, ODataUri uri, HttpHeaderCollection headers, string actionContentType, out Contracts.OData.ODataRequest request) { HttpVerb requestVerb = HttpVerb.Get; if (uri.IsAction()) { requestVerb = HttpVerb.Post; } if (uri.IsWebInvokeServiceOperation()) { requestVerb = HttpVerb.Post; } request = requestManager.BuildRequest(uri, requestVerb, headers); if (uri.IsAction()) { var procedurePayload = queryToPayloadConverter.ComputePayload(expression) as ComplexInstance; if (procedurePayload != null) { request.Headers.Add(HttpHeaders.ContentType, actionContentType); FixupAddingResultWrappers(actionContentType, procedurePayload); // TODO: Need to understand if product allow an Html form even if no parameters specified request.Body = requestManager.BuildBody(actionContentType, uri, procedurePayload); } } }
public void prop_ContentType_get() { var obj = new HttpHeaderCollection { new HttpHeader("Content-Type", "text/plain") }; Assert.Equal("text/plain", obj.ContentType.MediaType); }
public void op_Equals_object() { var obj = new HttpHeaderCollection { new HttpHeader("name", "value") }; Assert.True(HttpHeaderCollection.FromString("name: value").Equals(obj)); }
public void op_GetHashCode() { var obj = new HttpHeaderCollection { new HttpHeader("name", "value") }; var expected = obj.ToString().GetHashCode(); var actual = obj.GetHashCode(); Assert.Equal(expected, actual); }
public void op_Write_TextWriter() { var headers = new HttpHeaderCollection { new HttpHeader("Connection", "close") }; using (var stream = new MemoryStream()) { using (var writer = new StreamWriter(stream)) { headers.Write(writer); writer.Flush(); stream.Position = 0; using (var reader = new StreamReader(stream)) { Assert.Equal("Connection: close" + Environment.NewLine, reader.ReadToEnd()); } } } }
public void op_CopyTo_IHttpHeader_int() { var item = new HttpHeader("name", "value"); var obj = new HttpHeaderCollection { item }; var array = new IHttpHeader[1]; obj.CopyTo(array, 0); Assert.Equal(item, (HttpHeader)array[0]); }
public void op_ToString_whenMultiple() { var expected = new StringBuilder(); expected.AppendLine("name: foo, bar"); var obj = new HttpHeaderCollection { new HttpHeader("name", "foo"), new HttpHeader("name", "bar") }; var actual = obj.ToString(); Assert.Equal(expected.ToString(), actual); }
public void op_Read_TextReaderEmpty() { var obj = new HttpHeaderCollection(); using (var stream = new MemoryStream()) { using (var writer = new StreamWriter(stream)) { writer.Flush(); stream.Position = 0; using (var reader = new StreamReader(stream)) { obj.Read(reader); } } } Assert.Empty(obj); }
public void op_GetEnumerator() { var item = new HttpHeader("name", "value"); var obj = new HttpHeaderCollection { item }; using (var enumerator = obj.GetEnumerator()) { enumerator.MoveNext(); Assert.Same(item, enumerator.Current); } }
public void op_Remove_IHttpHeader() { var item = new HttpHeader("name", "value"); var obj = new HttpHeaderCollection { item }; obj.Remove(item); Assert.Equal(0, obj.Count); }