public override SC.IEnumerable Write(SC.IEnumerable enumerableInstance, object value) { SCG.IList <T> list = (SCG.IList <T>)enumerableInstance; T typedValue = (T)value; list.Add(typedValue); return(list); }
public void IList_Generic_IndexOf_ReturnsFirstMatchingValue(int count) { if (!IsReadOnly && !AddRemoveClear_ThrowsNotSupported) { SCG.IList <T> list = GenericIListFactory(count); foreach (T duplicate in list.ToList()) // hard copies list to circumvent enumeration error { list.Add(duplicate); } List <T> expectedList = list.ToList(); Assert.All(Enumerable.Range(0, count), (index => Assert.Equal(index, list.IndexOf(expectedList[index])) )); } }
public void IList_Generic_CurrentAtEnd_AfterAdd(int count) { if (!IsReadOnly && !AddRemoveClear_ThrowsNotSupported) { SCG.IList <T> collection = GenericIListFactory(count); using (SCG.IEnumerator <T> enumerator = collection.GetEnumerator()) { while (enumerator.MoveNext()) { ; // Go to end of enumerator } T current = default(T); if (Enumerator_Current_UndefinedOperation_Throws) { Assert.Throws <InvalidOperationException>(() => enumerator.Current); // enumerator.Current should fail } else { current = enumerator.Current; Assert.Equal(default(T), current); } // Test after add int seed = 3538963; for (int i = 0; i < 3; i++) { collection.Add(CreateT(seed++)); if (Enumerator_Current_UndefinedOperation_Throws) { Assert.Throws <InvalidOperationException>(() => enumerator.Current); // enumerator.Current should fail } else { current = enumerator.Current; Assert.Equal(default(T), current); } } } } }
public virtual void AddDocID(int docID) { docIDs.Add(docID); bytesUsed.AddAndGet(BYTES_PER_DEL_DOCID); }
internal virtual void AddDocID(int docID) // LUCENENET specific - Made internal rather than public, since this class is intended to be internal but couldn't be because it is exposed through a public API { docIDs.Add(docID); bytesUsed.AddAndGet(BYTES_PER_DEL_DOCID); }