2 // WebHeaderCollectionTest.cs - NUnit Test Cases for System.Net.WebHeaderCollection
5 // Lawrence Pit (loz@cable.a2000.nl)
6 // Martin Willemoes Hansen (mwh@sysrq.dk)
7 // Gert Driesen (drieseng@users.sourceforge.net)
8 // Gonzalo Paniagua Javier (gonzalo@novell.com)
10 // (C) 2003 Martin Willemoes Hansen
14 using System.Collections;
15 using System.Collections.Specialized;
18 using System.Runtime.Serialization;
19 using System.Runtime.Serialization.Formatters;
20 using System.Runtime.Serialization.Formatters.Binary;
22 using NUnit.Framework;
24 namespace MonoTests.System.Net
27 public class WebHeaderCollectionTest
29 WebHeaderCollection col;
32 public void GetReady ()
34 col = new WebHeaderCollection ();
35 col.Add ("Name1: Value1");
36 col.Add ("Name2: Value2");
45 } catch (ArgumentNullException) { }
49 } catch (ArgumentException) { }
53 } catch (ArgumentException) { }
57 } catch (ArgumentException) { }
61 } catch (ArgumentException) { }
64 col.Add ("XHost: foo");
65 } catch (ArgumentException) {
71 col.Add ("XHost" + ((char) 0xa9) + ": foo");
73 } catch (ArgumentException) { }
75 col.Add ("XHost: foo" + (char) 0xa9);
76 } catch (ArgumentException) {
80 col.Add ("XHost: foo" + (char) 0x7f);
82 } catch (ArgumentException) {
87 col.Add ("XHost", null);
88 } catch (ArgumentException) {
93 } catch (ArgumentException) {
99 // this can only be tested in namespace System.Net
101 WebHeaderCollection col2 = new WebHeaderCollection (true);
102 col2.Add ("Host: foo");
103 Assert.Fail ("#13: should fail according to spec");
104 } catch (ArgumentException) {}
109 [Category ("NotWorking")]
110 public void GetValues ()
112 WebHeaderCollection w = new WebHeaderCollection ();
113 w.Add ("Hello", "H1");
114 w.Add ("Hello", "H2");
115 w.Add ("Hello", "H3,H4");
117 string [] sa = w.GetValues ("Hello");
118 Assert.AreEqual (3, sa.Length, "#1");
119 Assert.AreEqual ("H1, H2,H3,H4", w.Get ("Hello"), "#2");
121 w = new WebHeaderCollection ();
122 w.Add ("Accept", "H1");
123 w.Add ("Accept", "H2");
124 w.Add ("Accept", "H3,H4");
125 Assert.AreEqual (3, w.GetValues (0).Length, "#3a");
126 Assert.AreEqual (4, w.GetValues ("Accept").Length, "#3b");
127 Assert.AreEqual ("H1, H2,H3,H4", w.Get ("Accept"), "#4");
129 w = new WebHeaderCollection ();
130 w.Add ("Allow", "H1");
131 w.Add ("Allow", "H2");
132 w.Add ("Allow", "H3,H4");
133 sa = w.GetValues ("Allow");
134 Assert.AreEqual (4, sa.Length, "#5");
135 Assert.AreEqual ("H1, H2,H3,H4", w.Get ("Allow"), "#6");
137 w = new WebHeaderCollection ();
138 w.Add ("AUTHorization", "H1, H2, H3");
139 sa = w.GetValues ("authorization");
140 Assert.AreEqual (3, sa.Length, "#9");
142 w = new WebHeaderCollection ();
143 w.Add ("proxy-authenticate", "H1, H2, H3");
144 sa = w.GetValues ("Proxy-Authenticate");
145 Assert.AreEqual (3, sa.Length, "#9");
147 w = new WebHeaderCollection ();
148 w.Add ("expect", "H1,\tH2, H3 ");
149 sa = w.GetValues ("EXPECT");
150 Assert.AreEqual (3, sa.Length, "#10");
151 Assert.AreEqual ("H2", sa [1], "#11");
152 Assert.AreEqual ("H3", sa [2], "#12");
157 } catch (ArgumentNullException) { }
158 Assert.AreEqual (null, w.GetValues (""), "#14");
159 Assert.AreEqual (null, w.GetValues ("NotExistent"), "#15");
163 public void Indexers ()
165 Assert.AreEqual ("Value1", ((NameValueCollection)col)[0], "#1.1");
166 //FIXME: test also HttpRequestHeader and HttpResponseHeader
167 //FIXME: is this enough?
168 WebHeaderCollection w = new WebHeaderCollection ();
169 w [HttpRequestHeader.CacheControl] = "Value2";
170 Assertion.AssertEquals ("#1.2", "Value2", w [HttpRequestHeader.CacheControl]);
171 w [HttpResponseHeader.Pragma] = "Value3";
172 Assertion.AssertEquals ("#1.3", "Value3", w [HttpResponseHeader.Pragma]);
176 public void Remove ()
178 col.Remove ("Name1");
179 col.Remove ("NameNotExist");
180 Assert.AreEqual (1, col.Count, "#1");
183 // this can only be tested in namespace System.Net
185 WebHeaderCollection col2 = new WebHeaderCollection (true);
186 col2.Add ("Host", "foo");
187 col2.Remove ("Host");
188 Assert.Fail ("#2: should fail according to spec");
189 } catch (ArgumentException) {}
196 col.Add ("Name1", "Value1b");
197 col.Set ("Name1", "\t X \t");
198 Assert.AreEqual ("X", col.Get ("Name1"), "#1");
202 public void IsRestricted ()
204 Assert.IsTrue (!WebHeaderCollection.IsRestricted ("Xhost"), "#1");
205 Assert.IsTrue (WebHeaderCollection.IsRestricted ("Host"), "#2");
206 Assert.IsTrue (WebHeaderCollection.IsRestricted ("HOST"), "#3");
207 Assert.IsTrue (WebHeaderCollection.IsRestricted ("Transfer-Encoding"), "#4");
208 Assert.IsTrue (WebHeaderCollection.IsRestricted ("user-agent"), "#5");
209 Assert.IsTrue (WebHeaderCollection.IsRestricted ("accept"), "#6");
210 Assert.IsTrue (!WebHeaderCollection.IsRestricted ("accept-charset"), "#7");
214 public void ToStringTest ()
216 col.Add ("Name1", "Value1b");
217 col.Add ("Name3", "Value3a\r\n Value3b");
218 col.Add ("Name4", " Value4 ");
219 Assert.AreEqual ("Name1: Value1,Value1b\r\nName2: Value2\r\nName3: Value3a\r\n Value3b\r\nName4: Value4\r\n\r\n", col.ToString (), "#1");
220 WebHeaderCollection w;
221 w = new WebHeaderCollection ();
222 w.Add (HttpResponseHeader.KeepAlive, "Value1");
223 w.Add (HttpResponseHeader.WwwAuthenticate, "Value2");
224 Assertion.AssertEquals ("#2", "Keep-Alive: Value1\r\nWWW-Authenticate: Value2\r\n\r\n", w.ToString ());
225 w = new WebHeaderCollection ();
226 w.Add (HttpRequestHeader.UserAgent, "Value1");
227 w.Add (HttpRequestHeader.ContentMd5, "Value2");
228 Assertion.AssertEquals ("#2", "User-Agent: Value1\r\nContent-MD5: Value2\r\n\r\n", w.ToString ());
233 //FIXME: include Java serialization compliant tests - the order of object
234 // in SerializationInfo should stay same to MS format...
235 [Ignore ("The MS compliant binary serialization is not supported")]
237 public void GetObjectData ()
239 SerializationInfo si = new SerializationInfo (typeof (WebHeaderCollection),
240 new FormatterConverter ());
242 WebHeaderCollection headers = new WebHeaderCollection ();
243 headers.Add ("Content-Type", "image/png");
244 headers.Add ("No-Cache:off");
245 headers.Add ("Disposition", "attach");
247 ((ISerializable) headers).GetObjectData (si, new StreamingContext ());
248 Assert.AreEqual (7, si.MemberCount, "#A");
250 foreach (SerializationEntry entry in si) {
251 Assert.IsNotNull (entry.Name, "#B1:" + i);
252 Assert.IsNotNull (entry.ObjectType, "#B2:" + i);
253 Assert.IsNotNull (entry.Value, "#B3:" + i);
257 Assert.AreEqual ("Count", entry.Name, "#B4:" + i);
258 Assert.AreEqual (typeof (int), entry.ObjectType, "#B5:" + i);
259 Assert.AreEqual (3, entry.Value, "#B6:" + i);
262 Assert.AreEqual ("0", entry.Name, "#B4:" + i);
263 Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
264 Assert.AreEqual ("Content-Type", entry.Value, "#B6:" + i);
267 Assert.AreEqual ("3", entry.Name, "#B4:" + i);
268 Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
269 Assert.AreEqual ("image/png", entry.Value, "#B6:" + i);
272 Assert.AreEqual ("1", entry.Name, "#B4:" + i);
273 Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
274 Assert.AreEqual ("No-Cache", entry.Value, "#B6:" + i);
277 Assert.AreEqual ("4", entry.Name, "#B4:" + i);
278 Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
279 Assert.AreEqual ("off", entry.Value, "#B6:" + i);
282 Assert.AreEqual ("2", entry.Name, "#B4:" + i);
283 Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
284 Assert.AreEqual ("Disposition", entry.Value, "#B6:" + i);
287 Assert.AreEqual ("5", entry.Name, "#B4:" + i);
288 Assert.AreEqual (typeof (string), entry.ObjectType, "#B5:" + i);
289 Assert.AreEqual ("attach", entry.Value, "#B6:" + i);
298 //FIXME: include Java serialization compliant tests
299 [Ignore ("The MS compliant binary serialization is not supported")]
301 public void Serialize ()
303 WebHeaderCollection headers = new WebHeaderCollection ();
304 headers.Add ("Content-Type", "image/png");
305 headers.Add ("No-Cache:off");
306 headers.Add ("Disposition", "attach");
308 BinaryFormatter bf = new BinaryFormatter ();
309 bf.AssemblyFormat = FormatterAssemblyStyle.Full;
311 MemoryStream ms = new MemoryStream ();
312 bf.Serialize (ms, headers);
315 byte [] buffer = new byte [ms.Length];
316 ms.Read (buffer, 0, buffer.Length);
317 Assert.AreEqual (_serialized, buffer);
322 //FIXME: include Java serialization compliant tests
323 [Ignore ("The MS compliant binary serialization format is not supported")]
325 public void Deserialize ()
327 MemoryStream ms = new MemoryStream ();
328 ms.Write (_serialized, 0, _serialized.Length);
331 BinaryFormatter bf = new BinaryFormatter ();
332 WebHeaderCollection headers = (WebHeaderCollection) bf.Deserialize (ms);
335 private static readonly byte [] _serialized = new byte [] {
337 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
339 0x49, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x56, 0x65,
340 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x32, 0x2e, 0x30, 0x2e, 0x30,
341 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74, 0x75, 0x72, 0x65,
342 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c, 0x2c, 0x20, 0x50,
343 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x6f, 0x6b,
344 0x65, 0x6e, 0x3d, 0x62, 0x37, 0x37, 0x61, 0x35, 0x63, 0x35, 0x36,
345 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39, 0x05, 0x01, 0x00,
346 0x00, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4e,
347 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48, 0x65, 0x61, 0x64, 0x65,
348 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
349 0x07, 0x00, 0x00, 0x00, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x01,
350 0x30, 0x01, 0x33, 0x01, 0x31, 0x01, 0x34, 0x01, 0x32, 0x01, 0x35,
351 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x02, 0x00, 0x00,
352 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x00, 0x0c,
353 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79, 0x70,
354 0x65, 0x06, 0x04, 0x00, 0x00, 0x00, 0x09, 0x69, 0x6d, 0x61, 0x67,
355 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x06, 0x05, 0x00, 0x00, 0x00, 0x08,
356 0x4e, 0x6f, 0x2d, 0x43, 0x61, 0x63, 0x68, 0x65, 0x06, 0x06, 0x00,
357 0x00, 0x00, 0x03, 0x6f, 0x66, 0x66, 0x06, 0x07, 0x00, 0x00, 0x00,
358 0x0b, 0x44, 0x69, 0x73, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
359 0x6e, 0x06, 0x08, 0x00, 0x00, 0x00, 0x06, 0x61, 0x74, 0x74, 0x61,
362 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00,
364 0x4c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x20, 0x56, 0x65,
365 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x31, 0x2e, 0x30, 0x2e, 0x35,
366 0x30, 0x30, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x43, 0x75, 0x6c, 0x74,
367 0x75, 0x72, 0x65, 0x3d, 0x6e, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6c,
368 0x2c, 0x20, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
369 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x3d, 0x62, 0x37, 0x37, 0x61, 0x35,
370 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39,
371 0x05, 0x01, 0x00, 0x00, 0x00, 0x1e, 0x53, 0x79, 0x73, 0x74, 0x65,
372 0x6d, 0x2e, 0x4e, 0x65, 0x74, 0x2e, 0x57, 0x65, 0x62, 0x48, 0x65,
373 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
374 0x69, 0x6f, 0x6e, 0x07, 0x00, 0x00, 0x00, 0x05, 0x43, 0x6f, 0x75,
375 0x6e, 0x74, 0x01, 0x30, 0x01, 0x33, 0x01, 0x31, 0x01, 0x34, 0x01,
376 0x32, 0x01, 0x35, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08,
377 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00,
378 0x00, 0x00, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d,
379 0x54, 0x79, 0x70, 0x65, 0x06, 0x04, 0x00, 0x00, 0x00, 0x09, 0x69,
380 0x6d, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x6e, 0x67, 0x06, 0x05, 0x00,
381 0x00, 0x00, 0x08, 0x4e, 0x6f, 0x2d, 0x43, 0x61, 0x63, 0x68, 0x65,
382 0x06, 0x06, 0x00, 0x00, 0x00, 0x03, 0x6f, 0x66, 0x66, 0x06, 0x07,
383 0x00, 0x00, 0x00, 0x0b, 0x44, 0x69, 0x73, 0x70, 0x6f, 0x73, 0x69,
384 0x74, 0x69, 0x6f, 0x6e, 0x06, 0x08, 0x00, 0x00, 0x00, 0x06, 0x61,
385 0x74, 0x74, 0x61, 0x63, 0x68, 0x0b
390 public void IsRestricted_InvalidChars_1 ()
402 int [] singles = new int [] { 34, 44, 47, 123, 125 };
403 foreach (int single in singles) {
405 WebHeaderCollection.IsRestricted (new string ((char) single, 1));
406 Assert.Fail (String.Format ("{0}: {1}", single, (char) single));
407 } catch (ArgumentException) {
410 for (int i = 0; i <= 32; i++) {
412 WebHeaderCollection.IsRestricted (new string ((char) i, 1));
413 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
414 } catch (ArgumentException) {
417 for (int i = 39; i <= 41; i++) {
419 WebHeaderCollection.IsRestricted (new string ((char) i, 1));
420 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
421 } catch (ArgumentException) {
424 for (int i = 91; i <= 93; i++) {
426 WebHeaderCollection.IsRestricted (new string ((char) i, 1));
427 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
428 } catch (ArgumentException) {
431 for (int i = 127; i <= 255; i++) {
433 WebHeaderCollection.IsRestricted (new string ((char) i, 1));
434 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
435 } catch (ArgumentException) {
441 public void IsRestricted_InvalidChars_Request_2 ()
453 int [] singles = new int [] { 34, 44, 47, 123, 125 };
454 foreach (int single in singles) {
456 WebHeaderCollection.IsRestricted (new string ((char) single, 1), false);
457 Assert.Fail (String.Format ("{0}: {1}", single, (char) single));
458 } catch (ArgumentException) {
461 for (int i = 0; i <= 32; i++) {
463 WebHeaderCollection.IsRestricted (new string ((char) i, 1), false);
464 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
465 } catch (ArgumentException) {
468 for (int i = 39; i <= 41; i++) {
470 WebHeaderCollection.IsRestricted (new string ((char) i, 1), false);
471 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
472 } catch (ArgumentException) {
475 for (int i = 91; i <= 93; i++) {
477 WebHeaderCollection.IsRestricted (new string ((char) i, 1), false);
478 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
479 } catch (ArgumentException) {
482 for (int i = 127; i <= 255; i++) {
484 WebHeaderCollection.IsRestricted (new string ((char) i, 1), false);
485 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
486 } catch (ArgumentException) {
492 public void IsRestricted_InvalidChars_Response_2 ()
504 int [] singles = new int [] { 34, 44, 47, 123, 125 };
505 foreach (int single in singles) {
507 WebHeaderCollection.IsRestricted (new string ((char) single, 1), true);
508 Assert.Fail (String.Format ("{0}: {1}", single, (char) single));
509 } catch (ArgumentException) {
512 for (int i = 0; i <= 32; i++) {
514 WebHeaderCollection.IsRestricted (new string ((char) i, 1), true);
515 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
516 } catch (ArgumentException) {
519 for (int i = 39; i <= 41; i++) {
521 WebHeaderCollection.IsRestricted (new string ((char) i, 1), true);
522 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
523 } catch (ArgumentException) {
526 for (int i = 91; i <= 93; i++) {
528 WebHeaderCollection.IsRestricted (new string ((char) i, 1), true);
529 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
530 } catch (ArgumentException) {
533 for (int i = 127; i <= 255; i++) {
535 WebHeaderCollection.IsRestricted (new string ((char) i, 1), true);
536 Assert.Fail (String.Format ("{0}: {1}", i, (char) i));
537 } catch (ArgumentException) {
542 static string [] request_headers = new string [] {
543 "Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", "Accept-Ranges", "Authorization",
544 "Cache-Control", "Connection", "Cookie", "Content-Length", "Content-Type", "Date",
545 "Expect", "From", "Host", "If-Match", "If-Modified-Since", "If-None-Match",
546 "If-Range", "If-Unmodified-Since", "Max-Forwards", "Pragma", "Proxy-Authorization",
547 "Range", "Referer", "TE", "Upgrade", "User-Agent", "Via", "Warn" };
549 static string [] response_headers = new string [] {
550 "Accept-Ranges", "Age", "Allow", "Cache-Control", "Content-Encoding", "Content-Language",
551 "Content-Length", "Content-Location", "Content-Disposition", "Content-MD5", "Content-Range",
552 "Content-Type", "Date", "ETag", "Expires", "Last-Modified", "Location", "Pragma",
553 "Proxy-Authenticate", "Retry-After", "Server", "Set-Cookie", "Trailer",
554 "Transfer-Encoding", "Vary", "Via", "Warn", "WWW-Authenticate" };
556 static string [] restricted_request_request = new string [] {
557 "Accept", "Connection", "Content-Length", "Content-Type", "Date",
558 "Expect", "Host", "If-Modified-Since", "Range", "Referer",
560 static string [] restricted_response_request = new string [] {
561 "Content-Length", "Content-Type", "Date", "Transfer-Encoding" };
563 static string [] restricted_request_response = new string [] {
565 static string [] restricted_response_response = new string [] {
566 "Content-Length", "Transfer-Encoding", "WWW-Authenticate" };
569 public void IsRestricted_2_0_RequestRequest ()
572 foreach (string str in request_headers) {
573 if (WebHeaderCollection.IsRestricted (str, false)) {
574 Assert.IsTrue (Array.IndexOf (restricted_request_request, str) != -1, "restricted " + str);
577 Assert.IsTrue (Array.IndexOf (restricted_request_request, str) == -1, str);
580 Assert.IsTrue (count == restricted_request_request.Length, "req-req length");
584 public void IsRestricted_2_0_ResponseRequest ()
587 foreach (string str in response_headers) {
588 if (WebHeaderCollection.IsRestricted (str, false)) {
589 Assert.IsTrue (Array.IndexOf (restricted_response_request, str) != -1, "restricted " + str);
592 Assert.IsTrue (Array.IndexOf (restricted_response_request, str) == -1, str);
595 Assert.IsTrue (count == restricted_response_request.Length, "length");
599 public void IsRestricted_2_0_RequestResponse ()
602 foreach (string str in request_headers) {
603 if (WebHeaderCollection.IsRestricted (str, true)) {
604 Assert.IsTrue (Array.IndexOf (restricted_request_response, str) != -1, "restricted " + str);
607 Assert.IsTrue (Array.IndexOf (restricted_request_response, str) == -1, str);
610 Assert.IsTrue (count == restricted_request_response.Length, "length");
614 public void IsRestricted_2_0_ResponseResponse ()
617 foreach (string str in response_headers) {
618 if (WebHeaderCollection.IsRestricted (str, true)) {
619 Assert.IsTrue (Array.IndexOf (restricted_response_response, str) != -1, "restricted " + str);
622 Assert.IsTrue (Array.IndexOf (restricted_response_response, str) == -1, str);
625 Assert.IsTrue (count == restricted_response_response.Length, "length");