186 instantiations of NameValueHeaderValue
Microsoft.Net.Http.Headers (10)
ContentDispositionHeaderValue.cs (3)
191Parameters.Add(new NameValueHeaderValue(SizeString, sizeString)); 394Parameters.Add(new NameValueHeaderValue(parameter, dateString)); 459Parameters.Add(new NameValueHeaderValue(parameter, processedValue));
HeaderUtilities.cs (1)
43parameters.Add(new NameValueHeaderValue(QualityName, qualityString));
MediaTypeHeaderValue.cs (2)
100Parameters.Add(new NameValueHeaderValue(CharsetString, value)); 174Parameters.Add(new NameValueHeaderValue(BoundaryString, value));
NameValueHeaderValue.cs (4)
89return new NameValueHeaderValue() 107return new NameValueHeaderValue() 364parsedValue = new NameValueHeaderValue(); 378parsedValue = new NameValueHeaderValue();
Microsoft.Net.Http.Headers.Tests (176)
CacheControlHeaderValueTest.cs (21)
62cacheControl.Extensions.Add(new NameValueHeaderValue("name", "value")); 64Assert.Equal(new NameValueHeaderValue("name", "value"), cacheControl.Extensions.First()); 97cacheControl.Extensions.Add(new NameValueHeaderValue("custom")); 98cacheControl.Extensions.Add(new NameValueHeaderValue("customName", "customValue")); 102cacheControl.Extensions.Add(new NameValueHeaderValue("custom")); 234cacheControl4.Extensions.Add(new NameValueHeaderValue("custom")); 237cacheControl5.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 238cacheControl5.Extensions.Add(new NameValueHeaderValue("custom")); 241cacheControl4.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 364cacheControl5.Extensions.Add(new NameValueHeaderValue("custom")); 367cacheControl6.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 368cacheControl6.Extensions.Add(new NameValueHeaderValue("custom")); 371cacheControl5.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 398expected.Extensions.Add(new NameValueHeaderValue("custom")); 407expected.Extensions.Add(new NameValueHeaderValue("c", "d")); 408expected.Extensions.Add(new NameValueHeaderValue("a", "b")); 418expected.Extensions.Add(new NameValueHeaderValue("custom", "")); 492expected.Extensions.Add(new NameValueHeaderValue("custom")); 496expected.Extensions.Add(new NameValueHeaderValue("custom", "")); 529expected.Extensions.Add(new NameValueHeaderValue("custom")); 533expected.Extensions.Add(new NameValueHeaderValue("custom", ""));
ContentDispositionHeaderValueTest.cs (33)
93NameValueHeaderValue name = new NameValueHeaderValue("NAME", "old_name"); 113var fileName = new NameValueHeaderValue("FILENAME", "old_name"); 163var fileName = new NameValueHeaderValue("FILENAME", "\"=?utf-99?Q?R=mlsZcODTmFtZS5iYXQ=?=\""); 185var fileNameStar = new NameValueHeaderValue("FILENAME*", "old_name"); 269var fileNameStar = new NameValueHeaderValue("FILENAME*", "utf-99'lang'File%CZName.bat"); 310var dateParameter = new NameValueHeaderValue("Creation-DATE", validDateString); 336var dateParameter = new NameValueHeaderValue("read-DATE", invalidDateString); 354var sizeParameter = new NameValueHeaderValue("SIZE", "279172874239"); 375var sizeParameter = new NameValueHeaderValue("SIZE", "-279172874239"); 407contentDisposition.Parameters.Add(new NameValueHeaderValue("custom", "\"custom value\"")); 436contentDisposition3.Parameters.Add(new NameValueHeaderValue("name", "value")); 439contentDisposition5.Parameters.Add(new NameValueHeaderValue("NAME", "MYNAME")); 455contentDisposition3.Parameters.Add(new NameValueHeaderValue("name", "value")); 458contentDisposition5.Parameters.Add(new NameValueHeaderValue("NAME", "MYNAME")); 460contentDisposition6.Parameters.Add(new NameValueHeaderValue("NAME", "MYNAME")); 461contentDisposition6.Parameters.Add(new NameValueHeaderValue("custom", "value")); 492expected.Parameters.Add(new NameValueHeaderValue("filename*", "UTF-8''foo-%c3%a4.html")); 544{ "inline;name=", new ContentDispositionHeaderValue("inline") { Parameters = { new NameValueHeaderValue("name", "") } } }, // TODO: passing in a null value causes a strange assert on CoreCLR before the test even starts. Not reproducible in the body of a test. 556{ @"attachment; foo=""bar""; filename=""foo.html""", new ContentDispositionHeaderValue(@"attachment") { FileName = @"""foo.html""", Parameters = { new NameValueHeaderValue("foo", @"""bar""") } } }, // 'attachment', specifying a filename of foo.html and an extension parameter "foo" which should be ignored (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.). 557{ @"attachment; foo=""\""\\"";filename=""foo.html""", new ContentDispositionHeaderValue(@"attachment") { FileName = @"""foo.html""", Parameters = { new NameValueHeaderValue("foo", @"""\""\\""") } } }, // 'attachment', specifying a filename of foo.html and an extension parameter "foo" which should be ignored (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.). The extension parameter actually uses backslash-escapes. This tests whether the UA properly skips the parameter. 561{ @"attachment; filename=""foo-ä.html""", new ContentDispositionHeaderValue("attachment" ) { Parameters = { new NameValueHeaderValue("filename", @"""foo-ä.html""") } } }, // 'attachment', specifying a filename of foo-ä.html, using plain ISO-8859-1 563{ @"attachment; filename=""foo-%41.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""foo-%41.html""") } } }, 564{ @"attachment; filename=""50%.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""50%.html""") } } }, 565{ @"attachment; filename=""foo-%\41.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""foo-%\41.html""") } } }, // 'attachment', specifying a filename of foo-%41.html, using an escape character (this tests whether adding an escape character inside a %xx sequence can be used to disable the non-conformant %xx-unescaping). 567{ @"attachment; filename=""ä-%41.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""ä-%41.html""") } } }, // 'attachment', specifying a filename parameter of ä-%41.html. (this test was added to observe the behavior when non-ASCII characters and percent-hexdig sequences are combined) 570{ @"attachment; xfilename=foo.html", new ContentDispositionHeaderValue("attachment" ) { Parameters = { new NameValueHeaderValue("xfilename", "foo.html") } } }, 572{ @"attachment; creation-date=""Wed, 12 Feb 1997 16:29:51 -0500""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("creation-date", @"""Wed, 12 Feb 1997 16:29:51 -0500""") } } }, 573{ @"attachment; modification-date=""Wed, 12 Feb 1997 16:29:51 -0500""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("modification-date", @"""Wed, 12 Feb 1997 16:29:51 -0500""") } } }, 575{ @"attachment; example=""filename=example.txt""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("example", @"""filename=example.txt""") } } }, 576{ @"attachment; filename*=iso-8859-1''foo-%E4.html", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename*", "iso-8859-1''foo-%E4.html") } } }, // 'attachment', specifying a filename of foo-ä.html, using RFC2231 encoded ISO-8859-1 577{ @"attachment; filename*=UTF-8''foo-%c3%a4-%e2%82%ac.html", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename*", "UTF-8''foo-%c3%a4-%e2%82%ac.html") } } }, // 'attachment', specifying a filename of foo-ä-&#x20ac;.html, using RFC2231 encoded UTF-8 578{ @"attachment; filename*=''foo-%c3%a4-%e2%82%ac.html", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename*", "''foo-%c3%a4-%e2%82%ac.html") } } }, // Behavior is undefined in RFC 2231, the charset part is missing, although UTF-8 was used. 586{ @"attachment; foobar=x; filename=""foo.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo.html""", Parameters = { new NameValueHeaderValue("foobar", "x") } } },
MediaTypeHeaderValueTest.cs (23)
156mediaType0.Parameters.Add(new NameValueHeaderValue("name", "value")); 173mediaType0.Parameters.Add(new NameValueHeaderValue("name", "value")); 184Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Add(new NameValueHeaderValue("name"))); 185Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Remove(new NameValueHeaderValue("name"))); 201mediaType0.Parameters.Add(new NameValueHeaderValue("name", "value")); 251var charset = new NameValueHeaderValue("CHARSET", "old_charset"); 286var quality = new NameValueHeaderValue("q", "0.132"); 306var quality = new NameValueHeaderValue("Q", "0.132"); 335mediaType.Parameters.Add(new NameValueHeaderValue("custom", "\"custom value\"")); 349mediaType3.Parameters.Add(new NameValueHeaderValue("name", "value")); 352mediaType5.Parameters.Add(new NameValueHeaderValue("CHARSET", "UTF-8")); 368mediaType3.Parameters.Add(new NameValueHeaderValue("name", "value")); 371mediaType5.Parameters.Add(new NameValueHeaderValue("CHARSET", "UTF-8")); 373mediaType6.Parameters.Add(new NameValueHeaderValue("CHARSET", "UTF-8")); 374mediaType6.Parameters.Add(new NameValueHeaderValue("custom", "value")); 400expected.Parameters.Add(new NameValueHeaderValue("custom", "value")); 404expected.Parameters.Add(new NameValueHeaderValue("custom")); 408expected.Parameters.Add(new NameValueHeaderValue("custom", "\"x\"")); 412expected.Parameters.Add(new NameValueHeaderValue("custom", "\"x\"")); 419expected.Parameters.Add(new NameValueHeaderValue("name", "")); 423expected.Parameters.Add(new NameValueHeaderValue("name", "value")); 441expected.Parameters.Add(new NameValueHeaderValue("foo", "bar")); 447expected.Parameters.Add(new NameValueHeaderValue("foo", "bar"));
NameValueHeaderValueTest.cs (99)
11Assert.Throws<ArgumentException>(() => new NameValueHeaderValue(null)); 13Assert.Throws<ArgumentException>(() => new NameValueHeaderValue(string.Empty)); 31var nameValue = new NameValueHeaderValue("text", null); 60var pair0 = new NameValueHeaderValue("name"); 76var pair0 = new NameValueHeaderValue("name"); 95var pair0 = new NameValueHeaderValue("name", "value"); 110var pair0 = new NameValueHeaderValue("name", "value"); 128var pair0 = new NameValueHeaderValue("name", "value"); 145Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = " x "; }); 146Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = "x y"; }); 152var nameValue = new NameValueHeaderValue("text", "token"); 168var nameValue1 = new NameValueHeaderValue("text"); 169var nameValue2 = new NameValueHeaderValue("text"); 207var nameValue1 = new NameValueHeaderValue("text"); 208var nameValue2 = new NameValueHeaderValue("TEXT"); 215var nameValue1 = new NameValueHeaderValue("text"); 216var nameValue2 = new NameValueHeaderValue("text"); 260var nameValue1 = new NameValueHeaderValue("text"); 261var nameValue2 = new NameValueHeaderValue("TEXT"); 268CheckValidParse(" name = value ", new NameValueHeaderValue("name", "value")); 269CheckValidParse(" name", new NameValueHeaderValue("name")); 270CheckValidParse(" name ", new NameValueHeaderValue("name")); 271CheckValidParse(" name=\"value\"", new NameValueHeaderValue("name", "\"value\"")); 272CheckValidParse("name=value", new NameValueHeaderValue("name", "value")); 273CheckValidParse("name=\"quoted str\"", new NameValueHeaderValue("name", "\"quoted str\"")); 274CheckValidParse("name\t =va1ue", new NameValueHeaderValue("name", "va1ue")); 275CheckValidParse("name= va*ue ", new NameValueHeaderValue("name", "va*ue")); 276CheckValidParse("name=", new NameValueHeaderValue("name", "")); 303CheckValidTryParse(" name = value ", new NameValueHeaderValue("name", "value")); 304CheckValidTryParse(" name", new NameValueHeaderValue("name")); 305CheckValidTryParse(" name=\"value\"", new NameValueHeaderValue("name", "\"value\"")); 306CheckValidTryParse("name=value", new NameValueHeaderValue("name", "value")); 348new NameValueHeaderValue("name", "value1"), 349new NameValueHeaderValue("name", "value2"), 350new NameValueHeaderValue("name", "value3"), 351new NameValueHeaderValue("name", "\"value 4\""), 352new NameValueHeaderValue("name", "\"value会5\""), 353new NameValueHeaderValue("name", "value6"), 354new NameValueHeaderValue("name", "value7"), 355new NameValueHeaderValue("name", "\"value 8\""), 356new NameValueHeaderValue("name", "\"value 9\""), 381new NameValueHeaderValue("name", "value1"), 382new NameValueHeaderValue("name", "value2"), 383new NameValueHeaderValue("name", "value3"), 384new NameValueHeaderValue("name", "\"value 4\""), 385new NameValueHeaderValue("name", "\"value会5\""), 386new NameValueHeaderValue("name", "value6"), 387new NameValueHeaderValue("name", "value7"), 388new NameValueHeaderValue("name", "\"value 8\""), 389new NameValueHeaderValue("name", "\"value 9\""), 414new NameValueHeaderValue("name", "value1"), 415new NameValueHeaderValue("name", "value2"), 416new NameValueHeaderValue("name", "value3"), 417new NameValueHeaderValue("name", "\"value 4\""), 418new NameValueHeaderValue("name", "\"value会5\""), 419new NameValueHeaderValue("name", "value6"), 420new NameValueHeaderValue("name", "value7"), 421new NameValueHeaderValue("name", "\"value 8\""), 422new NameValueHeaderValue("name", "\"value 9\""), 447new NameValueHeaderValue("name", "value1"), 448new NameValueHeaderValue("name", "value2"), 449new NameValueHeaderValue("name", "value3"), 450new NameValueHeaderValue("name", "\"value 4\""), 451new NameValueHeaderValue("name", "\"value会5\""), 452new NameValueHeaderValue("name", "value6"), 453new NameValueHeaderValue("name", "value7"), 454new NameValueHeaderValue("name", "\"value 8\""), 455new NameValueHeaderValue("name", "\"value 9\""), 480new NameValueHeaderValue("name1", "value1"), 481new NameValueHeaderValue("name2"), 482new NameValueHeaderValue("name3", "3"), 483new NameValueHeaderValue("a"), 484new NameValueHeaderValue("name4", "value4"), 485new NameValueHeaderValue("b"), 486new NameValueHeaderValue("6"), 487new NameValueHeaderValue("name7", "\"value会7\""), 488new NameValueHeaderValue("name8", "value8"), 489new NameValueHeaderValue("name9", "value9"), 490new NameValueHeaderValue("name10", "\"value 10\""), 491new NameValueHeaderValue("name11", "\"value 11\""), 534new NameValueHeaderValue("name1", "value1"), 535new NameValueHeaderValue("name2"), 536new NameValueHeaderValue("name3", "3"), 537new NameValueHeaderValue("a"), 538new NameValueHeaderValue("name4", "value4"), 539new NameValueHeaderValue("b"), 540new NameValueHeaderValue("6"), 541new NameValueHeaderValue("name7", "\"value会7\""), 542new NameValueHeaderValue("name8", "value8"), 543new NameValueHeaderValue("name9", "value9"), 544new NameValueHeaderValue("name10", "\"value 10\""), 545new NameValueHeaderValue("name11", "\"value 11\""), 580var header = new NameValueHeaderValue("test", input); 600var header = new NameValueHeaderValue("test"); 614var header = new NameValueHeaderValue("test"); 624var header = new NameValueHeaderValue("test"); 639var header = new NameValueHeaderValue("test"); 675var nameValue = new NameValueHeaderValue("text", value); 681Assert.Throws<FormatException>(() => new NameValueHeaderValue(name, value));
156 references to NameValueHeaderValue
Microsoft.Net.Http.Headers (92)
CacheControlHeaderValue.cs (13)
102private IList<NameValueHeaderValue>? _extensions; 316public IList<NameValueHeaderValue> Extensions 322_extensions = new ObjectCollection<NameValueHeaderValue>(); 393NameValueHeaderValue.ToString(_extensions, ',', false, sb); 474foreach (var extension in _extensions) 532var nameValueList = new List<NameValueHeaderValue>(); 535if (!NameValueHeaderValue.MultipleValueParser.TryParseValue(input, ref current, out var nameValue)) 566List<NameValueHeaderValue> nameValueList) 570var nameValue = nameValueList[i]; 698private static bool TrySetTokenOnlyValue(NameValueHeaderValue nameValue, ref bool boolField) 710NameValueHeaderValue nameValue, 771private static bool TrySetTimeSpan(NameValueHeaderValue nameValue, ref TimeSpan? timeSpan)
ContentDispositionHeaderValue.cs (18)
47private ObjectCollection<NameValueHeaderValue>? _parameters; 81public IList<NameValueHeaderValue> Parameters 87_parameters = new ObjectCollection<NameValueHeaderValue>(); 158var sizeParameter = NameValueHeaderValue.Find(_parameters, SizeString); 171var sizeParameter = NameValueHeaderValue.Find(_parameters, SizeString); 227return _dispositionType + NameValueHeaderValue.ToString(_parameters, ';', true); 248return StringSegmentComparer.OrdinalIgnoreCase.GetHashCode(_dispositionType) ^ NameValueHeaderValue.GetHashCode(_parameters); 302int parameterLength = NameValueHeaderValue.GetNameValueListLength(input, current, ';', 354var dateParameter = NameValueHeaderValue.Find(_parameters, parameter); 375var dateParameter = NameValueHeaderValue.Find(_parameters, parameter); 403var nameParameter = NameValueHeaderValue.Find(_parameters, parameter); 432var nameParameter = NameValueHeaderValue.Find(_parameters, parameter);
HeaderUtilities.cs (7)
21internal static void SetQuality(IList<NameValueHeaderValue> parameters, double? value) 23var qualityParameter = NameValueHeaderValue.Find(parameters, QualityName); 56internal static double? GetQuality(IList<NameValueHeaderValue>? parameters) 58var qualityParameter = NameValueHeaderValue.Find(parameters, QualityName); 193current += NameValueHeaderValue.GetValueLength(headerValue, current);
MediaTypeHeaderValue.cs (18)
36private ObjectCollection<NameValueHeaderValue>? _parameters; 76return NameValueHeaderValue.Find(_parameters, CharsetString)?.Value ?? default; 83var charsetParameter = NameValueHeaderValue.Find(_parameters, CharsetString); 152return NameValueHeaderValue.Find(_parameters, BoundaryString)?.Value ?? default(StringSegment); 157var boundaryParameter = NameValueHeaderValue.Find(_parameters, BoundaryString); 184public IList<NameValueHeaderValue> Parameters 192_parameters = ObjectCollection<NameValueHeaderValue>.EmptyReadOnlyCollection; 196_parameters = new ObjectCollection<NameValueHeaderValue>(); 410other._parameters = new ObjectCollection<NameValueHeaderValue>( 432other._parameters = new ObjectCollection<NameValueHeaderValue>( 469NameValueHeaderValue.ToString(_parameters, separator: ';', leadingSeparator: true, destination: builder); 491return StringSegmentComparer.OrdinalIgnoreCase.GetHashCode(_mediaType) ^ NameValueHeaderValue.GetHashCode(_parameters); 590var parameterLength = NameValueHeaderValue.GetNameValueListLength(input, current, ';', 789foreach (var parameter in set._parameters) 805var localParameter = NameValueHeaderValue.Find(_parameters, parameter.Name);
NameValueHeaderValue.cs (36)
20private static readonly HttpHeaderParser<NameValueHeaderValue> SingleValueParser 21= new GenericHeaderParser<NameValueHeaderValue>(false, GetNameValueLength); 22internal static readonly HttpHeaderParser<NameValueHeaderValue> MultipleValueParser 23= new GenericHeaderParser<NameValueHeaderValue>(true, GetNameValueLength); 35/// Initializes a new instance of <see cref="NameValueHeaderValue"/>. 44/// Initializes a new instance of <see cref="NameValueHeaderValue"/>. 87public NameValueHeaderValue Copy() 99/// <returns>The readonly <see cref="NameValueHeaderValue"/>.</returns> 100public NameValueHeaderValue CopyAsReadOnly() 140var other = obj as NameValueHeaderValue; 204/// Parses <paramref name="input"/> as a <see cref="NameValueHeaderValue"/> value. 208public static NameValueHeaderValue Parse(StringSegment input) 215/// Attempts to parse the specified <paramref name="input"/> as a <see cref="NameValueHeaderValue"/>. 219/// <returns><see langword="true"/> if input is a valid <see cref="NameValueHeaderValue"/>, otherwise <see langword="false"/>.</returns> 220public static bool TryParse(StringSegment input, [NotNullWhen(true)] out NameValueHeaderValue? parsedValue) 227/// Parses a sequence of inputs as a sequence of <see cref="NameValueHeaderValue"/> values. 231public static IList<NameValueHeaderValue> ParseList(IList<string>? input) 237/// Parses a sequence of inputs as a sequence of <see cref="NameValueHeaderValue"/> values using string parsing rules. 241public static IList<NameValueHeaderValue> ParseStrictList(IList<string>? input) 247/// Attempts to parse the sequence of values as a sequence of <see cref="NameValueHeaderValue"/>. 251/// <returns><see langword="true"/> if all inputs are valid <see cref="NameValueHeaderValue"/>, otherwise <see langword="false"/>.</returns> 252public static bool TryParseList(IList<string>? input, [NotNullWhen(true)] out IList<NameValueHeaderValue>? parsedValues) 258/// Attempts to parse the sequence of values as a sequence of <see cref="NameValueHeaderValue"/> using string parsing rules. 263public static bool TryParseStrictList(IList<string>? input, [NotNullWhen(true)] out IList<NameValueHeaderValue>? parsedValues) 279IList<NameValueHeaderValue>? values, 307internal static string? ToString(IList<NameValueHeaderValue>? values, char separator, bool leadingSeparator) 321internal static int GetHashCode(IList<NameValueHeaderValue>? values) 336private static int GetNameValueLength(StringSegment input, int startIndex, out NameValueHeaderValue? parsedValue) 392IList<NameValueHeaderValue> nameValueCollection) 404var nameValueLength = GetNameValueLength(input, current, out var parameter); 429/// Finds a <see cref="NameValueHeaderValue"/> with the specified <paramref name="name"/>. 433/// <returns>The <see cref="NameValueHeaderValue" /> if found, otherwise <see langword="null" />.</returns> 434public static NameValueHeaderValue? Find(IList<NameValueHeaderValue>? values, StringSegment name) 445var value = values[i];
Microsoft.Net.Http.Headers.Tests (64)
ContentDispositionHeaderValueTest.cs (9)
93NameValueHeaderValue name = new NameValueHeaderValue("NAME", "old_name"); 113var fileName = new NameValueHeaderValue("FILENAME", "old_name"); 163var fileName = new NameValueHeaderValue("FILENAME", "\"=?utf-99?Q?R=mlsZcODTmFtZS5iYXQ=?=\""); 185var fileNameStar = new NameValueHeaderValue("FILENAME*", "old_name"); 269var fileNameStar = new NameValueHeaderValue("FILENAME*", "utf-99'lang'File%CZName.bat"); 310var dateParameter = new NameValueHeaderValue("Creation-DATE", validDateString); 336var dateParameter = new NameValueHeaderValue("read-DATE", invalidDateString); 354var sizeParameter = new NameValueHeaderValue("SIZE", "279172874239"); 375var sizeParameter = new NameValueHeaderValue("SIZE", "-279172874239");
MediaTypeHeaderValueTest.cs (9)
162var pair0 = mediaType0.Parameters.First(); 163var pair1 = mediaType1.Parameters.First(); 188var pair0 = mediaType0.Parameters.First(); 189var pair1 = mediaType1.Parameters.First(); 211var pair2 = mediaType2.Parameters.First(); 212var pair1 = mediaType1.Parameters.First(); 251var charset = new NameValueHeaderValue("CHARSET", "old_charset"); 286var quality = new NameValueHeaderValue("q", "0.132"); 306var quality = new NameValueHeaderValue("Q", "0.132");
NameValueHeaderValueTest.cs (46)
31var nameValue = new NameValueHeaderValue("text", null); 60var pair0 = new NameValueHeaderValue("name"); 61var pair1 = pair0.Copy(); 76var pair0 = new NameValueHeaderValue("name"); 77var pair1 = pair0.CopyAsReadOnly(); 95var pair0 = new NameValueHeaderValue("name", "value"); 96var pair1 = pair0.Copy(); 110var pair0 = new NameValueHeaderValue("name", "value"); 111var pair1 = pair0.CopyAsReadOnly(); 128var pair0 = new NameValueHeaderValue("name", "value"); 129var pair1 = pair0.CopyAsReadOnly(); 130var pair2 = pair1.Copy(); 145Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = " x "; }); 146Assert.Throws<FormatException>(() => { var x = new NameValueHeaderValue("name"); x.Value = "x y"; }); 152var nameValue = new NameValueHeaderValue("text", "token"); 168var nameValue1 = new NameValueHeaderValue("text"); 169var nameValue2 = new NameValueHeaderValue("text"); 207var nameValue1 = new NameValueHeaderValue("text"); 208var nameValue2 = new NameValueHeaderValue("TEXT"); 215var nameValue1 = new NameValueHeaderValue("text"); 216var nameValue2 = new NameValueHeaderValue("text"); 260var nameValue1 = new NameValueHeaderValue("text"); 261var nameValue2 = new NameValueHeaderValue("TEXT"); 344var results = NameValueHeaderValue.ParseList(inputs); 377var results = NameValueHeaderValue.ParseStrictList(inputs); 410Assert.True(NameValueHeaderValue.TryParseList(inputs, out var results)); 443Assert.True(NameValueHeaderValue.TryParseStrictList(inputs, out var results)); 476var results = NameValueHeaderValue.ParseList(inputs); 512Assert.Throws<FormatException>(() => NameValueHeaderValue.ParseStrictList(inputs)); 530Assert.True(NameValueHeaderValue.TryParseList(inputs, out var results)); 566Assert.False(NameValueHeaderValue.TryParseStrictList(inputs, out var results)); 580var header = new NameValueHeaderValue("test", input); 600var header = new NameValueHeaderValue("test"); 614var header = new NameValueHeaderValue("test"); 624var header = new NameValueHeaderValue("test"); 639var header = new NameValueHeaderValue("test"); 650private void CheckValidParse(string? input, NameValueHeaderValue expectedResult) 652var result = NameValueHeaderValue.Parse(input); 658Assert.Throws<FormatException>(() => NameValueHeaderValue.Parse(input)); 661private void CheckValidTryParse(string? input, NameValueHeaderValue expectedResult) 663Assert.True(NameValueHeaderValue.TryParse(input, out var result)); 669Assert.False(NameValueHeaderValue.TryParse(input, out var result)); 675var nameValue = new NameValueHeaderValue("text", value);