public virtual void TestClear() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); set.Add(ItemOne); set.Clear(); Assert.AreEqual(0, set.Count); }
/// <exception cref="System.Exception"></exception> public virtual void TestGetInternalImplementation() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); BTree bTree = BTree(set); Assert.IsNotNull(bTree); }
private Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> NewBigSet(params BigSetTestCase.Item [] initialSet) { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = CollectionFactory.ForObjectContainer (Db()).NewBigSet <BigSetTestCase.Item>(); Sharpen.Collections.AddAll(set, Arrays.AsList(initialSet)); return(set); }
public virtual void TestIsEmpty() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); Assert.IsTrue(set.IsEmpty); set.Add(ItemOne); Assert.IsFalse(set.IsEmpty); set.Remove(ItemOne); Assert.IsTrue(set.IsEmpty); }
public virtual void TestRemoveAll() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); IList <BigSetTestCase.Item> collection = ItemList(); Sharpen.Collections.AddAll(set, collection); Assert.IsTrue(set.RemoveAll(collection)); Assert.AreEqual(0, set.Count); Assert.IsFalse(set.RemoveAll(collection)); }
/// <exception cref="System.Exception"></exception> public virtual void TestDefragment() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); set.Add(ItemOne); Db().Store(set); Db().Commit(); Defragment(); set = (Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item>)RetrieveOnlyInstance (set.GetType()); AssertSinglePersistentItem(set); }
public virtual void TestIterator() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); ICollection <BigSetTestCase.Item> collection = ItemList(); Sharpen.Collections.AddAll(set, collection); IEnumerator i = set.GetEnumerator(); Assert.IsNotNull(i); IteratorAssert.SameContent(collection.GetEnumerator(), i); }
/// <exception cref="System.Exception"></exception> public virtual void TestDelete() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); set.Add(ItemOne); Db().Store(set); Db().Commit(); BTree bTree = BTree(set); BTreeAssert.AssertAllSlotsFreed(FileTransaction(), bTree, new _ICodeBlock_259(this , set)); Assert.Expect(typeof(InvalidOperationException), new _ICodeBlock_265(set)); }
public virtual void TestRemove() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); IList <BigSetTestCase.Item> collection = ItemList(); Sharpen.Collections.AddAll(set, collection); BigSetTestCase.Item first = collection[0]; set.Remove(first); Assert.IsTrue(collection.Remove(first)); Assert.IsFalse(collection.Remove(first)); Assert.IsTrue(set.ContainsAll(collection)); Assert.IsFalse(set.Contains(first)); }
private void RunTestAfterCommit(IProcedure4 setOperations) { BigSetTestCase.Holder <BigSetTestCase.Item> holder = NewHolderWithBigSet(new BigSetTestCase.Item ("1"), new BigSetTestCase.Item("2")); StoreAndCommit(holder); Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = holder._set; Assert.AreEqual(2, set.Count); setOperations.Apply(set); PurgeAll(holder, holder._set); BigSetTestCase.Holder <BigSetTestCase.Item> resurrected = (BigSetTestCase.Holder <BigSetTestCase.Item >)RetrieveOnlyInstance(holder.GetType()); IteratorAssert.SameContent(set.GetEnumerator(), resurrected._set.GetEnumerator()); }
/// <exception cref="System.Exception"></exception> public virtual void TestPersistence() { BigSetTestCase.Holder <BigSetTestCase.Item> holder = new BigSetTestCase.Holder <BigSetTestCase.Item >(); holder._set = NewBigSet(); Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = holder._set; set.Add(ItemOne); Store(holder); Reopen(); holder = (BigSetTestCase.Holder <BigSetTestCase.Item>)RetrieveOnlyInstance(holder. GetType()); set = holder._set; AssertSinglePersistentItem(set); }
private void AssertSinglePersistentItem(Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item > set) { BigSetTestCase.Item expectedItem = (BigSetTestCase.Item)RetrieveOnlyInstance(typeof( BigSetTestCase.Item)); Assert.IsNotNull(set); Assert.AreEqual(1, set.Count); IEnumerator setIterator = set.GetEnumerator(); Assert.IsNotNull(setIterator); Assert.IsTrue(setIterator.MoveNext()); BigSetTestCase.Item actualItem = (BigSetTestCase.Item)setIterator.Current; Assert.AreSame(expectedItem, actualItem); }
public virtual void TestSize() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); set.Add(ItemOne); Assert.AreEqual(1, set.Count); set.Remove(ItemOne); Assert.AreEqual(0, set.Count); BigSetTestCase.Item itemTwo = new BigSetTestCase.Item("two"); set.Add(itemTwo); set.Add(new BigSetTestCase.Item("three")); Assert.AreEqual(2, set.Count); set.Remove(itemTwo); Assert.AreEqual(1, set.Count); }
/// <exception cref="System.MemberAccessException"></exception> public static BTree BTree(Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set ) { return((BTree)Reflection4.GetFieldValue(set, "_bTree")); }
public virtual void TestContains() { Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet(); set.Add(ItemOne); Assert.IsTrue(set.Contains(ItemOne)); }
public _ICodeBlock_265(Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set) { this.set = set; }
public _ICodeBlock_259(BigSetTestCase _enclosing, Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set) { this._enclosing = _enclosing; this.set = set; }