private IEnumerable NewIterable(int[] values) { Collection4 collection = new Collection4(); collection.AddAll(IntArrays4.ToObjectArray(values)); return(collection); }
public virtual void TestAddAllAndToArray() { object[] array = IntArrays4.ToObjectArray(new int[] { 6, 4, 1, 2, 7, 3 }); SortedCollection4 collection = NewSortedCollection(); Assert.AreEqual(0, collection.Size()); collection.AddAll(new ArrayIterator4(array)); AssertCollection(new int[] { 1, 2, 3, 4, 6, 7 }, collection); }
public virtual void TestTraverseValues() { IStoredField field = StoredField(); ExpectingVisitor expectingVisitor = new ExpectingVisitor(IntArrays4.ToObjectArray (Foos)); field.TraverseValues(expectingVisitor); expectingVisitor.AssertExpectations(); }
private void AssertIterateValues(int[] values) { ExpectingVisitor expectingVisitor = new ExpectingVisitor(IntArrays4.ToObjectArray (values), true, false); IEnumerator i = new TreeKeyIterator(CreateTree(values)); while (i.MoveNext()) { expectingVisitor.Visit(i.Current); } expectingVisitor.AssertExpectations(); }
private void AssertIDs(IQueryResult queryResult, int[] expectedIDs, bool ignoreUnexpected ) { ExpectingVisitor expectingVisitor = new ExpectingVisitor(IntArrays4.ToObjectArray (expectedIDs), false, ignoreUnexpected); IIntIterator4 i = queryResult.IterateIDs(); while (i.MoveNext()) { expectingVisitor.Visit(i.CurrentInt()); } expectingVisitor.AssertExpectations(); }
private void AssertReadModePointerIteration(int[] expectedKeys, BTreePointer pointer ) { object[] expected = IntArrays4.ToObjectArray(expectedKeys); for (int i = 0; i < expected.Length; i++) { Assert.IsNotNull(pointer, "Expected '" + expected[i] + "'"); Assert.AreNotSame(_btree.Root(), pointer.Node()); AssertInReadModeOrCached(pointer.Node()); Assert.AreEqual(expected[i], pointer.Key()); AssertInReadModeOrCached(pointer.Node()); pointer = pointer.Next(); } }
private void AssertCollection(int[] expected, SortedCollection4 collection) { Assert.AreEqual(expected.Length, collection.Size()); ArrayAssert.AreEqual(IntArrays4.ToObjectArray(expected), collection.ToArray(new object [collection.Size()])); }