public void CountedSetSupportsGenericIteration() { var set = new CountedSet <string>(new[] { "foo", "foo", "foo", "bar", "bar" }); Assert.DoesNotThrow(() => { IEnumerator <string> enumerator = set.GetEnumerator(); while (enumerator.MoveNext()) { //ignore empty block } }); }
public void CountSetSupportsGenericIterationForExpectedNumberOfElements() { const int expected = 2; int count = 0; var set = new CountedSet <string>(new[] { "foo", "foo", "foo", "bar", "bar" }); IEnumerator <string> enumerator = set.GetEnumerator(); while (enumerator.MoveNext()) { count++; } Assert.AreEqual(expected, count); }