public void AddItem_Fact() { var list = new StringList(); list.ShouldHaveState(0, 0); list.Add("Hello"); list.ShouldHaveState(1, 1, "Hello"); list.Add("Good-bye"); list.ShouldHaveState(2, 2, "Hello", "Good-bye"); }
public StringList CloneSublist(int count) { if (count < 0 || count > _storage.Count) { throw new ArgumentOutOfRangeException("count"); } if (count == Count) { return(new StringList(this)); } var clone = new StringList(); var enumerator = new StringListEnumerator(_storage, false); while (count > 0) { enumerator.MoveNext(); clone.Add(enumerator.Current); count--; } return(clone); }