public void CanEnumerateItems() { var destList = new ListAdapter <string, Uri>( str => new Uri(str), uri => uri.ToString(), (str, uri) => string.Equals(str, uri?.ToString()), new List <Uri>()) { "http://maps.google.com", "http://www.twitter.com", "http://localhost/one", "http://localhost/two", "http://localhost/three" }; var count = 0; foreach (var item in destList) { destList.Contains(item).Should().BeTrue(); count++; } count.Should().Be(destList.Count); }
public void ContainsWorksAsExpected() { var wrappedList = new List <Uri>(); var destList = new ListAdapter <string, Uri>( str => new Uri(str), uri => uri.ToString(), (str, uri) => string.Equals(str, uri?.ToString()), wrappedList) { "http://maps.google.com", "http://www.twitter.com" }; destList.Contains("http://www.twitter.com/").Should().BeTrue(); wrappedList.Contains(new Uri("http://www.twitter.com/")).Should().BeTrue(); destList.Contains("mailto:[email protected]").Should().BeFalse(); }
public void Contains() { Assert.That(_adapter.Contains("7"), Is.False); Assert.That(_adapter.Contains("1"), Is.True); Assert.That(_adapter.Contains("b"), Is.False); }