public void ForeachShouldIterateOverAllAddedValues() { var addedValues = new HashSet <int>(); var hashedset = new HashedSet <int>(); sampleNames.ForEach(n => { hashedset.Add(n.Length); addedValues.Add(n.Length); }); hashedset.ForEach(v => Assert.IsTrue(addedValues.Contains(v))); }
public void UnionShouldProduceSetContainingElementsFromBothSets() { ICollection <int> numbers = new List <int>() { 1, 2, 3, 4, 5, 6, 7 }; var hashedset = new HashedSet <int>(); sampleNames.ForEach(n => hashedset.Add(n.Length)); var result = hashedset.UnionWith(numbers); numbers.ForEach(x => Assert.IsTrue(result.Contains(x))); hashedset.ForEach(x => Assert.IsTrue(result.Contains(x))); }
public void ForeachShouldIterateOverAllAddedValues() { var addedValues = new HashSet<int>(); var hashedset = new HashedSet<int>(); sampleNames.ForEach(n => { hashedset.Add(n.Length); addedValues.Add(n.Length); }); hashedset.ForEach(v => Assert.IsTrue(addedValues.Contains(v))); }
public void UnionShouldProduceSetContainingElementsFromBothSets() { ICollection<int> numbers = new List<int>() { 1, 2, 3, 4, 5, 6, 7 }; var hashedset = new HashedSet<int>(); sampleNames.ForEach(n => hashedset.Add(n.Length)); var result = hashedset.UnionWith(numbers); numbers.ForEach(x => Assert.IsTrue(result.Contains(x))); hashedset.ForEach(x => Assert.IsTrue(result.Contains(x))); }