public void Remove_AddValuesThenCallRemove_ReturnsTrueWhenRemovingExistingValuesFalseOtherwise() { MockHeaders headers = new MockHeaders(); HttpHeaderValueCollection <Uri> collection = new HttpHeaderValueCollection <Uri>(knownUriHeader, headers); 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/")); Assert.True(collection.Remove(new Uri("http://www.example.org/2/")), "Expected true for existing item."); Assert.False(collection.Remove(new Uri("http://www.example.org/4/")), "Expected false for non-existing item."); }
public void Remove_CallWithNullValue_Throw() { MockHeaders headers = new MockHeaders(); HttpHeaderValueCollection <Uri> collection = new HttpHeaderValueCollection <Uri>(knownUriHeader, headers); Assert.Throws <ArgumentNullException>(() => { collection.Remove(null); }); }
public void Ctor_ProvideValidator_ValidatorIsUsedWhenRemovingValues() { // Use different ctor overload than in previous test to make sure all ctor overloads work correctly. MockHeaders headers = new MockHeaders(); HttpHeaderValueCollection <Uri> collection = new HttpHeaderValueCollection <Uri>(knownUriHeader, headers, specialValue, MockValidator); // When we remove 'invalidValue' our MockValidator will throw. Assert.Throws <MockException>(() => { collection.Remove(invalidValue); }); }
public void Ctor_ProvideValidator_ValidatorIsUsedWhenRemovingValues() { // Use different ctor overload than in previous test to make sure all ctor overloads work correctly. MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); HttpHeaderValueCollection<Uri> collection = new HttpHeaderValueCollection<Uri>(knownHeader, headers, specialValue, MockValidator); // When we remove 'invalidValue' our MockValidator will throw. Assert.Throws<MockException>(() => { collection.Remove(invalidValue); }); }
public void Remove_AddValuesThenCallRemove_ReturnsTrueWhenRemovingExistingValuesFalseOtherwise() { MockHeaders headers = new MockHeaders(knownHeader, new MockHeaderParser(typeof(Uri))); HttpHeaderValueCollection<Uri> collection = new HttpHeaderValueCollection<Uri>(knownHeader, headers); 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/")); Assert.True(collection.Remove(new Uri("http://www.example.org/2/")), "Expected true for existing item."); Assert.False(collection.Remove(new Uri("http://www.example.org/4/")), "Expected false for non-existing item."); }
public void Remove_CallWithNullValue_Throw() { MockHeaders headers = new MockHeaders(); HttpHeaderValueCollection<Uri> collection = new HttpHeaderValueCollection<Uri>(knownHeader, headers); Assert.Throws<ArgumentNullException>(() => { collection.Remove(null); }); }