public override void ICollection_Generic_Add_DefaultValue(int count)
 {
     // Adding an item to a TreeSubset does nothing - it updates the parent.
     if (DefaultValueAllowed && !IsReadOnly && !AddRemoveClear_ThrowsNotSupported && CanAddDefaultValue)
     {
         SCG.ICollection <T> collection = GenericICollectionFactory(count);
         collection.Add(default(T));
         Assert.Equal(count + 1, collection.Count); // collection is also updated.
         Assert.Equal(count + 1, OriginalSet.Count);
     }
 }
예제 #2
0
 public void TrySCGColl(SCG.ICollection <double> coll)
 {
     // All members of SCG.ICollection<T>
     Assert.AreEqual(0, coll.Count);
     double[] arr = { };
     coll.CopyTo(arr, 0);
     Assert.IsFalse(coll.IsReadOnly);
     coll.Add(2.3);
     coll.Add(3.2);
     Assert.AreEqual(2, coll.Count);
     Assert.IsTrue(coll.Contains(2.3));
     Assert.IsFalse(coll.Contains(3.1));
     Assert.IsFalse(coll.Remove(3.1));
     Assert.IsTrue(coll.Remove(3.2));
     Assert.IsFalse(coll.Contains(3.1));
     Assert.AreEqual(1, coll.Count);
     coll.Clear();
     Assert.AreEqual(0, coll.Count);
     Assert.IsFalse(coll.Remove(3.1));
 }
 public override void ICollection_Generic_Contains_DefaultValueOnCollectionContainingDefaultValue(int count)
 {
     if (DefaultValueAllowed && !IsReadOnly && !AddRemoveClear_ThrowsNotSupported)
     {
         SCG.ICollection <string> collection = GenericICollectionFactory(count);
         AssertExtensions.Throws <ArgumentOutOfRangeException>("item", /*null,*/ () => collection.Add(default(string)));
     }
 }