Exemple #1
0
 public virtual void TestClear()
 {
     Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet();
     set.Add(ItemOne);
     set.Clear();
     Assert.AreEqual(0, set.Count);
 }
Exemple #2
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestGetInternalImplementation()
        {
            Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet();
            BTree bTree = BTree(set);

            Assert.IsNotNull(bTree);
        }
Exemple #3
0
 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);
 }
Exemple #4
0
 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);
 }
Exemple #5
0
        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));
        }
Exemple #6
0
 /// <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);
 }
Exemple #7
0
        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);
        }
Exemple #8
0
        /// <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));
        }
Exemple #9
0
        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));
        }
Exemple #10
0
 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());
 }
Exemple #11
0
 /// <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);
 }
Exemple #12
0
        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);
        }
Exemple #13
0
 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);
 }
Exemple #14
0
 /// <exception cref="System.MemberAccessException"></exception>
 public static BTree BTree(Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set
                           )
 {
     return((BTree)Reflection4.GetFieldValue(set, "_bTree"));
 }
Exemple #15
0
 public virtual void TestContains()
 {
     Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set = NewBigSet();
     set.Add(ItemOne);
     Assert.IsTrue(set.Contains(ItemOne));
 }
Exemple #16
0
 public _ICodeBlock_265(Db4objects.Db4o.Collections.ISet <BigSetTestCase.Item> set)
 {
     this.set = set;
 }
Exemple #17
0
 public _ICodeBlock_259(BigSetTestCase _enclosing, Db4objects.Db4o.Collections.ISet
                        <BigSetTestCase.Item> set)
 {
     this._enclosing = _enclosing;
     this.set        = set;
 }