public void GetEnumerator_AddValuesAndSpecialValueAndGetEnumeratorFromInterface_AllValuesReturned()
{
MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri)));
HttpHeaderValueCollection<Uri> collection = new HttpHeaderValueCollection<Uri>(knownHeader, headers,
specialValue);
collection.Add(new Uri("http://www.example.org/1/"));
collection.Add(new Uri("http://www.example.org/2/"));
collection.Add(new Uri("http://www.example.org/3/"));
collection.SetSpecialValue();
System.Collections.IEnumerable enumerable = collection;
// The "special value" should be ignored and not part of the resulting collection.
int i = 1;
bool specialFound = false;
foreach (var item in enumerable)
{
if (item.Equals(specialValue))
{
specialFound = true;
}
else
{
Assert.Equal(new Uri("http://www.example.org/" + i + "/"), item);
i++;
}
}
Assert.True(specialFound);
Assert.True(collection.IsSpecialValueSet, "Special value not set.");
}