public void GetHashCode_UseTransferCodingWithAndWithoutParameters_SameOrDifferentHashCodes() { TransferCodingHeaderValue transferCoding1 = new TransferCodingHeaderValue("custom"); TransferCodingHeaderValue transferCoding2 = new TransferCodingHeaderValue("CUSTOM"); TransferCodingHeaderValue transferCoding3 = new TransferCodingHeaderValue("custom"); transferCoding3.Parameters.Add(new NameValueHeaderValue("name", "value")); TransferCodingHeaderValue transferCoding4 = new TransferCodingHeaderValue("custom"); transferCoding4.Parameters.Add(new NameValueHeaderValue("NAME", "VALUE")); TransferCodingHeaderValue transferCoding5 = new TransferCodingHeaderValue("custom"); transferCoding5.Parameters.Add(new NameValueHeaderValue("name", "\"value\"")); TransferCodingHeaderValue transferCoding6 = new TransferCodingHeaderValue("custom"); transferCoding6.Parameters.Add(new NameValueHeaderValue("name", "\"VALUE\"")); TransferCodingHeaderValue transferCoding7 = new TransferCodingHeaderValue("custom"); transferCoding7.Parameters.Add(new NameValueHeaderValue("name", "\"VALUE\"")); transferCoding7.Parameters.Clear(); Assert.Equal(transferCoding1.GetHashCode(), transferCoding2.GetHashCode()); Assert.NotEqual(transferCoding1.GetHashCode(), transferCoding3.GetHashCode()); Assert.Equal(transferCoding3.GetHashCode(), transferCoding4.GetHashCode()); Assert.NotEqual(transferCoding5.GetHashCode(), transferCoding6.GetHashCode()); Assert.Equal(transferCoding1.GetHashCode(), transferCoding7.GetHashCode()); }
private void CheckValidTryParse(string input, TransferCodingHeaderValue expectedResult) { TransferCodingHeaderValue result = null; Assert.True(TransferCodingHeaderValue.TryParse(input, out result)); Assert.Equal(expectedResult, result); }
private void CheckInvalidParse(string input) { Assert.Throws <FormatException>(() => { TransferCodingHeaderValue.Parse(input); }); Assert.False(TransferCodingHeaderValue.TryParse(input, out TransferCodingHeaderValue result)); Assert.Null(result); }
private void CheckInvalidTryParse(string input) { TransferCodingHeaderValue result = null; Assert.False(TransferCodingHeaderValue.TryParse(input, out result)); Assert.Null(result); }
public void Parse_Invalid() { try { TransferCodingHeaderValue.Parse(null); Assert.Fail("#1"); } catch (FormatException) { } try { TransferCodingHeaderValue.Parse(" "); Assert.Fail("#2"); } catch (FormatException) { } try { TransferCodingHeaderValue.Parse("a b"); Assert.Fail("#3"); } catch (FormatException) { } try { TransferCodingHeaderValue.Parse("a;"); Assert.Fail("#4"); } catch (FormatException) { } try { TransferCodingHeaderValue.Parse("u;v=\"\"\"\""); Assert.Fail("#5"); } catch (FormatException) { } }
public void Ctor_TransferCodingValidFormat_SuccessfullyCreated() { TransferCodingHeaderValue transferCoding = new TransferCodingHeaderValue("custom"); Assert.Equal("custom", transferCoding.Value); Assert.Equal(0, transferCoding.Parameters.Count); }
public void GetTransferCodingLength_DifferentInvalidScenarios_AllReturnZero() { TransferCodingHeaderValue result = null; Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength(" custom", 0, DummyCreator, out result)); Assert.Null(result); Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength("custom;", 0, DummyCreator, out result)); Assert.Null(result); Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength("custom;name=", 0, DummyCreator, out result)); Assert.Null(result); Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength("custom;name=value;", 0, DummyCreator, out result)); Assert.Null(result); Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength("custom;name=,value;", 0, DummyCreator, out result)); Assert.Null(result); Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength("custom;", 0, DummyCreator, out result)); Assert.Null(result); Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength(null, 0, DummyCreator, out result)); Assert.Null(result); Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength(string.Empty, 0, DummyCreator, out result)); Assert.Null(result); }
public void Value() { var tfhv = new TransferCodingHeaderValue("value"); Assert.AreEqual("value", tfhv.Value, "#1"); Assert.IsNotNull(tfhv.Parameters, "#2"); }
public void TryParse_Invalid() { TransferCodingHeaderValue res; Assert.IsFalse(TransferCodingHeaderValue.TryParse("a b", out res), "#1"); Assert.IsNull(res, "#2"); }
public void TryParse() { TransferCodingHeaderValue res; Assert.IsTrue(TransferCodingHeaderValue.TryParse("content", out res), "#1"); Assert.AreEqual("content", res.Value, "#2"); }
public void TryParse_SetOfValidValueStrings_ParsedCorrectly() { TransferCodingHeaderValue expected = new TransferCodingHeaderValue("custom"); CheckValidParsedValue("\r\n custom ", 0, expected, 11); CheckValidParsedValue("custom", 0, expected, 6); CheckValidParsedValue(",,custom", 0, expected, 8); CheckValidParsedValue(" , , custom", 0, expected, 11); CheckValidParsedValue("\r\n custom , chunked", 0, expected, 13); CheckValidParsedValue("\r\n custom , , , chunked", 0, expected, 17); CheckValidParsedValue(null, 0, null, 0); CheckValidParsedValue(string.Empty, 0, null, 0); CheckValidParsedValue(" ", 0, null, 2); CheckValidParsedValue(" ,,", 0, null, 4); // Note that even if the whole string is invalid, the first transfer-coding value is valid. When the parser // gets called again using the result-index (9), then it fails: I.e. we have 1 valid transfer-coding // and an invalid one. CheckValidParsedValue("custom , 会", 0, expected, 9); // We don't have to test all possible input strings, since most of the pieces are handled by other parsers. // The purpose of this test is to verify that these other parsers are combined correctly to build a // transfer-coding parser. expected.Parameters.Add(new NameValueHeaderValue("name", "value")); CheckValidParsedValue("\r\n custom ; name = value ", 0, expected, 28); CheckValidParsedValue("\r\n , , custom ; name = value ", 0, expected, 32); CheckValidParsedValue(" custom;name=value", 2, expected, 19); CheckValidParsedValue(" custom ; name=value", 2, expected, 21); }
public void Equals_UseTransferCodingWithAndWithoutParameters_EqualOrNotEqualNoExceptions() { TransferCodingHeaderValue transferCoding1 = new TransferCodingHeaderValue("custom"); TransferCodingHeaderValue transferCoding2 = new TransferCodingHeaderValue("CUSTOM"); TransferCodingHeaderValue transferCoding3 = new TransferCodingHeaderValue("custom"); transferCoding3.Parameters.Add(new NameValueHeaderValue("name", "value")); TransferCodingHeaderValue transferCoding4 = new TransferCodingHeaderValue("custom"); transferCoding4.Parameters.Add(new NameValueHeaderValue("NAME", "VALUE")); TransferCodingHeaderValue transferCoding5 = new TransferCodingHeaderValue("custom"); transferCoding5.Parameters.Add(new NameValueHeaderValue("name", "\"value\"")); TransferCodingHeaderValue transferCoding6 = new TransferCodingHeaderValue("custom"); transferCoding6.Parameters.Add(new NameValueHeaderValue("name", "\"VALUE\"")); TransferCodingHeaderValue transferCoding7 = new TransferCodingHeaderValue("custom"); transferCoding7.Parameters.Add(new NameValueHeaderValue("name", "\"VALUE\"")); transferCoding7.Parameters.Clear(); Assert.False(transferCoding1.Equals(null), "Compare to <null>."); Assert.True(transferCoding1.Equals(transferCoding2), "Different casing."); Assert.False(transferCoding1.Equals(transferCoding3), "No params vs. custom param."); Assert.True(transferCoding3.Equals(transferCoding4), "Params have different casing."); Assert.False(transferCoding5.Equals(transferCoding6), "Param value are quoted strings with different casing."); Assert.True(transferCoding1.Equals(transferCoding7), "no vs. empty parameters collection."); }
public void GetTransferCodingLength_DifferentValidScenarios_AllReturnNonZero() { TransferCodingHeaderValue result = null; Assert.Equal(7, TransferCodingHeaderValue.GetTransferCodingLength("chunked", 0, DummyCreator, out result)); Assert.Equal("chunked", result.Value); Assert.Equal(0, result.Parameters.Count); Assert.Equal(5, TransferCodingHeaderValue.GetTransferCodingLength("gzip , chunked", 0, DummyCreator, out result)); Assert.Equal("gzip", result.Value); Assert.Equal(0, result.Parameters.Count); Assert.Equal(18, TransferCodingHeaderValue.GetTransferCodingLength("custom; name=value", 0, DummyCreator, out result)); Assert.Equal("custom", result.Value); Assert.Equal(1, result.Parameters.Count); Assert.Equal("name", result.Parameters.ElementAt(0).Name); Assert.Equal("value", result.Parameters.ElementAt(0).Value); // Note that TransferCodingHeaderValue recognizes the first transfer-coding as valid, even though it is // followed by an invalid character. The parser will call GetTransferCodingLength() starting at the invalid // character which will result in GetTransferCodingLength() returning 0 (see next test). Assert.Equal(26, TransferCodingHeaderValue.GetTransferCodingLength( " custom;name1=value1;name2 , \u4F1A", 1, DummyCreator, out result)); Assert.Equal("custom", result.Value); Assert.Equal(2, result.Parameters.Count); Assert.Equal("name1", result.Parameters.ElementAt(0).Name); Assert.Equal("value1", result.Parameters.ElementAt(0).Value); Assert.Equal("name2", result.Parameters.ElementAt(1).Name); Assert.Null(result.Parameters.ElementAt(1).Value); // There will be no exception for invalid characters. GetTransferCodingLength() will just return a length // of 0. The caller needs to validate if that's OK or not. Assert.Equal(0, TransferCodingHeaderValue.GetTransferCodingLength("\u4F1A", 0, DummyCreator, out result)); Assert.Equal(45, TransferCodingHeaderValue.GetTransferCodingLength( " custom ; name1 =\r\n \"value1\" ; name2 = value2 , next", 2, DummyCreator, out result)); Assert.Equal("custom", result.Value); Assert.Equal(2, result.Parameters.Count); Assert.Equal("name1", result.Parameters.ElementAt(0).Name); Assert.Equal("\"value1\"", result.Parameters.ElementAt(0).Value); Assert.Equal("name2", result.Parameters.ElementAt(1).Name); Assert.Equal("value2", result.Parameters.ElementAt(1).Value); Assert.Equal(32, TransferCodingHeaderValue.GetTransferCodingLength( " custom;name1=value1;name2=value2,next", 1, DummyCreator, out result)); Assert.Equal("custom", result.Value); Assert.Equal(2, result.Parameters.Count); Assert.Equal("name1", result.Parameters.ElementAt(0).Name); Assert.Equal("value1", result.Parameters.ElementAt(0).Value); Assert.Equal("name2", result.Parameters.ElementAt(1).Name); Assert.Equal("value2", result.Parameters.ElementAt(1).Value); }
/// <summary> /// Sets the TransferEncoding header for the HTTP request. /// </summary> /// <param name="request">The request to which to add the Header</param> /// <param name="type">The encoding string to use as the Header value.</param> /// <returns>The request that was passed as the first argument, so that literate calls may be chained together.</returns> /// <example><![CDATA[ /// var request = HttpRequestMessageExt.Create("https://www.example.com"); /// request.Header("Keep-Alive", 1) /// .Header("DNT", 1") /// .Accept(MediaType.Text_Plain) /// .Encoding("utf-8"); /// ]]></example> public static HttpRequestMessage TransferEncoding(this HttpRequestMessage request, string encoding) { if (request is null) { throw new ArgumentNullException(nameof(request)); } request.Headers.TransferEncodingChunked = true; request.Headers.TransferEncoding.Add(TransferCodingHeaderValue.Parse(encoding)); return(request); }
private void CheckValidParsedValue(string input, int index, TransferCodingHeaderValue expectedResult, int expectedIndex) { TransferCodingHeaderParser parser = TransferCodingHeaderParser.MultipleValueParser; object result = null; Assert.True(parser.TryParseValue(input, null, ref index, out result), string.Format("TryParse returned false. Input: '{0}', Index: {1}", input, index)); Assert.Equal(expectedIndex, index); Assert.Equal(result, expectedResult); }
public void Parse_ValidValue_ReturnsTransferCodingHeaderValue() { // This test verifies that Parse() correctly calls TryParse(). TransferCodingHeaderParser parser = TransferCodingHeaderParser.MultipleValueParser; int index = 2; TransferCodingHeaderValue expected = new TransferCodingHeaderValue("custom"); expected.Parameters.Add(new NameValueHeaderValue("name", "value")); Assert.True(expected.Equals(parser.ParseValue(" custom ; name = value ", null, ref index))); Assert.Equal(25, index); }
public void ToString_UseDifferentTransferCodings_AllSerializedCorrectly() { TransferCodingHeaderValue transferCoding = new TransferCodingHeaderValue("custom"); Assert.Equal("custom", transferCoding.ToString()); transferCoding.Parameters.Add(new NameValueHeaderValue("paramName", "\"param value\"")); Assert.Equal("custom; paramName=\"param value\"", transferCoding.ToString()); transferCoding.Parameters.Add(new NameValueHeaderValue("paramName2", "\"param value2\"")); Assert.Equal("custom; paramName=\"param value\"; paramName2=\"param value2\"", transferCoding.ToString()); }
public void Ctor_Invalid() { try { var tfhv = new TransferCodingHeaderValue(null); Assert.Fail("#1"); } catch (ArgumentException) { } try { var tfhv = new TransferCodingHeaderValue("my value"); Assert.Fail("#2"); } catch (FormatException) { } }
public void TryParse_SetOfValidValueStrings_ParsedCorrectly() { TransferCodingHeaderValue expected = new TransferCodingHeaderValue("custom"); CheckValidTryParse("\r\n custom ", expected); CheckValidTryParse("custom", expected); // We don't have to test all possible input strings, since most of the pieces are handled by other parsers. // The purpose of this test is to verify that these other parsers are combined correctly to build a // transfer-coding parser. expected.Parameters.Add(new NameValueHeaderValue("name", "value")); CheckValidTryParse("\r\n custom ; name = value ", expected); CheckValidTryParse(" custom;name=value", expected); CheckValidTryParse(" custom ; name=value", expected); }
public void Clone_Call_CloneFieldsMatchSourceFields() { TransferCodingHeaderValue source = new TransferCodingHeaderValue("custom"); TransferCodingHeaderValue clone = (TransferCodingHeaderValue)((ICloneable)source).Clone(); Assert.Equal(source.Value, clone.Value); Assert.Equal(0, clone.Parameters.Count); source.Parameters.Add(new NameValueHeaderValue("custom", "customValue")); clone = (TransferCodingHeaderValue)((ICloneable)source).Clone(); Assert.Equal(source.Value, clone.Value); Assert.Equal(1, clone.Parameters.Count); Assert.Equal("custom", clone.Parameters.ElementAt(0).Name); Assert.Equal("customValue", clone.Parameters.ElementAt(0).Value); }
public void Equals() { var tfhv = new TransferCodingWithQualityHeaderValue("abc"); Assert.AreEqual(tfhv, new TransferCodingWithQualityHeaderValue("abc"), "#1"); Assert.AreEqual(tfhv, new TransferCodingWithQualityHeaderValue("AbC"), "#2"); Assert.AreNotEqual(tfhv, new TransferCodingWithQualityHeaderValue("ab"), "#3"); Assert.AreNotEqual(tfhv, new TransferCodingWithQualityHeaderValue("ab", 1), "#3"); tfhv = new TransferCodingWithQualityHeaderValue("abc", 0.3); Assert.AreEqual(tfhv, new TransferCodingWithQualityHeaderValue("abc", 0.3), "#4"); Assert.AreEqual(tfhv, new TransferCodingWithQualityHeaderValue("AbC", 0.3), "#5"); Assert.AreNotEqual(tfhv, new TransferCodingWithQualityHeaderValue("abc"), "#6"); var custom_param = new TransferCodingHeaderValue("abc"); custom_param.Parameters.Add(new NameValueHeaderValue("q", "0.3")); Assert.AreEqual(tfhv, custom_param, "#7"); }
public void Equals() { var tfhv = new TransferCodingHeaderValue("abc"); Assert.AreEqual(tfhv, new TransferCodingHeaderValue("abc"), "#1"); Assert.AreEqual(tfhv, new TransferCodingHeaderValue("AbC"), "#2"); tfhv.Parameters.Add(new NameValueHeaderValue("p", "v")); Assert.AreNotEqual(tfhv, new TransferCodingHeaderValue("abc"), "#3"); var tfhv2 = new TransferCodingHeaderValue("abc"); Assert.AreNotEqual(tfhv, tfhv2, "#4"); tfhv2.Parameters.Add(new NameValueHeaderValue("p", "v")); Assert.AreEqual(tfhv, tfhv2, "#5"); }
public void Parse() { var res = TransferCodingHeaderValue.Parse("content"); Assert.AreEqual("content", res.Value, "#1"); Assert.AreEqual("content", res.ToString(), "#1a"); res = TransferCodingHeaderValue.Parse(" a ;b;c "); Assert.AreEqual("a", res.Value, "#2"); Assert.AreEqual("a; b; c", res.ToString(), "#2a"); Assert.AreEqual("b", res.Parameters.First().ToString(), "#2b"); res = TransferCodingHeaderValue.Parse(" a ; v = m "); Assert.AreEqual("a", res.Value, "#3"); Assert.AreEqual("a; v=m", res.ToString(), "#3a"); Assert.AreEqual("m", res.Parameters.First().Value, "#3b"); res = TransferCodingHeaderValue.Parse("\ta; v = \"mmm\" "); Assert.AreEqual("a", res.Value, "#4"); Assert.AreEqual("a; v=\"mmm\"", res.ToString(), "#4a"); Assert.AreEqual("\"mmm\"", res.Parameters.First().Value, "#4b"); }
public async Task <string> GetTextFromAudioAsync(string recordedFilename) { var file = await ApplicationData.Current.LocalFolder.GetFileAsync(recordedFilename); using (var fileStream = new FileStream(file.Path, FileMode.Open, FileAccess.Read)) { using (var client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); client.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("text/xml")); client.DefaultRequestHeaders.TransferEncoding.Add(TransferCodingHeaderValue.Parse("chunked")); client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "API키를 입력하세요"); var content = new StreamContent(fileStream); content.Headers.Add("ContentType", new[] { "audio/wav", "codec=audio/pcm", "samplerate=16000" }); try { var response = await client.PostAsync(_requestUri, content); var responseContent = await response.Content.ReadAsStringAsync(); var speechResults = JsonConvert.DeserializeObject <BinSpeechResult>(responseContent); content.Dispose(); return(speechResults.DisplayText); } catch (Exception e) { content.Dispose(); Console.WriteLine(e); throw; } } } }
internal virtual HttpRequestMessage GetRequest(Uri uri, bool stripAuthorization) { Uri requestUri = PrepareUri(uri); HttpMethod httpMethod = null; switch (ParameterSetName) { case "StandardMethodNoProxy": goto case "StandardMethod"; case "StandardMethod": // set the method if the parameter was provided httpMethod = GetHttpMethod(Method); break; case "CustomMethodNoProxy": goto case "CustomMethod"; case "CustomMethod": if (!string.IsNullOrEmpty(CustomMethod)) { // set the method if the parameter was provided httpMethod = new HttpMethod(CustomMethod.ToString().ToUpperInvariant()); } break; } // create the base WebRequest object var request = new HttpRequestMessage(httpMethod, requestUri); // pull in session data if (WebSession.Headers.Count > 0) { WebSession.ContentHeaders.Clear(); foreach (var entry in WebSession.Headers) { if (HttpKnownHeaderNames.ContentHeaders.Contains(entry.Key)) { WebSession.ContentHeaders.Add(entry.Key, entry.Value); } else { if (stripAuthorization && String.Equals(entry.Key, HttpKnownHeaderNames.Authorization.ToString(), StringComparison.OrdinalIgnoreCase) ) { continue; } if (SkipHeaderValidation) { request.Headers.TryAddWithoutValidation(entry.Key, entry.Value); } else { request.Headers.Add(entry.Key, entry.Value); } } } } // Set 'Transfer-Encoding: chunked' if 'Transfer-Encoding' is specified if (WebSession.Headers.ContainsKey(HttpKnownHeaderNames.TransferEncoding)) { request.Headers.TransferEncodingChunked = true; } // Set 'User-Agent' if WebSession.Headers doesn't already contain it string userAgent = null; if (WebSession.Headers.TryGetValue(HttpKnownHeaderNames.UserAgent, out userAgent)) { WebSession.UserAgent = userAgent; } else { if (SkipHeaderValidation) { request.Headers.TryAddWithoutValidation(HttpKnownHeaderNames.UserAgent, WebSession.UserAgent); } else { request.Headers.Add(HttpKnownHeaderNames.UserAgent, WebSession.UserAgent); } } // Set 'Keep-Alive' to false. This means set the Connection to 'Close'. if (DisableKeepAlive) { request.Headers.Add(HttpKnownHeaderNames.Connection, "Close"); } // Set 'Transfer-Encoding' if (TransferEncoding != null) { request.Headers.TransferEncodingChunked = true; var headerValue = new TransferCodingHeaderValue(TransferEncoding); if (!request.Headers.TransferEncoding.Contains(headerValue)) { request.Headers.TransferEncoding.Add(headerValue); } } // Some web sites (e.g. Twitter) will return exception on POST when Expect100 is sent // Default behavior is continue to send body content anyway after a short period // Here it send the two part as a whole. request.Headers.ExpectContinue = false; return(request); }
public static bool TryParse(string input, out TransferCodingHeaderValue parsedValue);
internal virtual HttpRequestMessage GetRequest(Uri uri) { Uri requestUri = PrepareUri(uri); HttpMethod httpMethod = GetHttpMethod(Method); // create the base WebRequest object var request = new HttpRequestMessage(httpMethod, requestUri); // pull in session data if (WebSession.Headers.Count > 0) { WebSession.ContentHeaders.Clear(); foreach (var entry in WebSession.Headers) { if (HttpKnownHeaderNames.ContentHeaders.Contains(entry.Key)) { WebSession.ContentHeaders.Add(entry.Key, entry.Value); } else { request.Headers.Add(entry.Key, entry.Value); } } } // Set 'Transfer-Encoding: chunked' if 'Transfer-Encoding' is specified if (WebSession.Headers.ContainsKey(HttpKnownHeaderNames.TransferEncoding)) { request.Headers.TransferEncodingChunked = true; } // Set 'User-Agent' if WebSession.Headers doesn't already contain it string userAgent = null; if (WebSession.Headers.TryGetValue(HttpKnownHeaderNames.UserAgent, out userAgent)) { WebSession.UserAgent = userAgent; } else { request.Headers.Add(HttpKnownHeaderNames.UserAgent, WebSession.UserAgent); } // Set 'Keep-Alive' to false. This means set the Connection to 'Close'. if (DisableKeepAlive) { request.Headers.Add(HttpKnownHeaderNames.Connection, "Close"); } // Set 'Transfer-Encoding' if (TransferEncoding != null) { request.Headers.TransferEncodingChunked = true; var headerValue = new TransferCodingHeaderValue(TransferEncoding); if (!request.Headers.TransferEncoding.Contains(headerValue)) { request.Headers.TransferEncoding.Add(headerValue); } } // Some web sites (e.g. Twitter) will return exception on POST when Expect100 is sent // Default behaviour is continue to send body content anyway after a short period // Here it send the two part as a whole. request.Headers.ExpectContinue = false; return(request); }
private void CheckValidParse(string input, TransferCodingHeaderValue expectedResult) { TransferCodingHeaderValue result = TransferCodingHeaderValue.Parse(input); Assert.Equal(expectedResult, result); }
public void Parameters_AddNull_Throw() { TransferCodingHeaderValue transferCoding = new TransferCodingHeaderValue("custom"); Assert.Throws <ArgumentNullException>(() => { transferCoding.Parameters.Add(null); }); }
private void CheckInvalidParse(string input) { Assert.Throws <FormatException>(() => { TransferCodingHeaderValue.Parse(input); }); }