public void op_Remove_NameValueConfigurationElement_whenEmpty() { var element = new RedirectionConfigurationElement <AbsoluteUri>("http://example.com/", "http://example.net/"); var obj = new RedirectionConfigurationElementCollection <AbsoluteUri>(); Assert.False(obj.Remove(element)); }
public void op_Contains_NameValueConfigurationElement() { var element = new RedirectionConfigurationElement <AbsoluteUri>("http://example.com/", "http://example.net/"); var obj = new RedirectionConfigurationElementCollection <AbsoluteUri> { element }; Assert.True(obj.Contains(element)); }
public void op_Remove_NameValueConfigurationElement() { var element = new RedirectionConfigurationElement <AbsoluteUri>("http://example.com/", "http://example.net/"); var obj = new RedirectionConfigurationElementCollection <AbsoluteUri> { new RedirectionConfigurationElement <AbsoluteUri>("http://example.org/", "http://example.co.uk/"), element }; Assert.True(obj.Remove(element)); Assert.False(obj.Contains(element)); }
public bool Remove(RedirectionConfigurationElement <T> item) { for (var i = 0; i < Count; i++) { if (!ReferenceEquals(BaseGet(i), item)) { continue; } BaseRemoveAt(i); return(true); } return(false); }
public bool Contains(RedirectionConfigurationElement <T> item) { #if NET20 foreach (var element in this) { if (ReferenceEquals(element, item)) { return(true); } } return(false); #else return(this.Any(element => ReferenceEquals(element, item))); #endif }
public void op_CopyTo_NameValueConfigurationElement_int() { var expected = new RedirectionConfigurationElement <AbsoluteUri>("http://example.com/", "http://example.net/"); var obj = new RedirectionConfigurationElementCollection <AbsoluteUri> { expected, new RedirectionConfigurationElement <AbsoluteUri>("http://example.org/", "http://example.co.uk/") }; var array = new RedirectionConfigurationElement <AbsoluteUri> [obj.Count]; obj.CopyTo(array, 0); var actual = array.First(); Assert.Equal(expected, actual); }
public void Add(RedirectionConfigurationElement <T> item) { BaseAdd(item); }