public virtual void TestPrepend() { Collection4 c = new Collection4(); c.Prepend("foo"); AssertCollection(new string[] { "foo" }, c); c.Add("bar"); AssertCollection(new string[] { "foo", "bar" }, c); c.Prepend("baz"); AssertCollection(new string[] { "baz", "foo", "bar" }, c); c.Prepend("gazonk"); AssertCollection(new string[] { "gazonk", "baz", "foo", "bar" }, c); }
private Collection4 FieldPathFromTop() { var q = this; var fieldPath = new Collection4(); while (q.i_parent != null) { fieldPath.Prepend(q.i_field); q = q.i_parent; } return fieldPath; }
public virtual void TestNulls() { Collection4 c = new Collection4(); c.Add("one"); AssertNotContainsNull(c); c.Add(null); AssertContainsNull(c); AssertCollection(new string[] { "one", null }, c); c.Prepend(null); AssertCollection(new string[] { null, "one", null }, c); c.Prepend("zero"); c.Add("two"); AssertCollection(new string[] { "zero", null, "one", null, "two" }, c); AssertContainsNull(c); c.Remove(null); AssertCollection(new string[] { "zero", "one", null, "two" }, c); c.Remove(null); AssertNotContainsNull(c); AssertCollection(new string[] { "zero", "one", "two" }, c); c.Remove(null); AssertCollection(new string[] { "zero", "one", "two" }, c); }
private IEnumerator FieldNames(FieldValue fieldValue) { Collection4 coll = new Collection4(); IComparisonOperand curOp = fieldValue; while (curOp is FieldValue) { FieldValue curField = (FieldValue)curOp; coll.Prepend(curField.FieldName()); curOp = curField.Parent(); } return coll.GetEnumerator(); }