public void GetAny() { Assert.IsTrue(_collection.Contains(_collection.GetAny())); Int32HashSet collection = new Int32HashSet(); Assert.Throws <InvalidOperationException>(() => collection.GetAny()); }
public void SetUp() { _collection = new Int32HashSet(); _readOnly = _collection.AsReadOnly(); Assert.AreEqual(0, _collection.Count); _collection.Add(1); _collection.Add(2); _collection.Add(3); Assert.AreEqual(3, _collection.Count); }
public void Constructor() { var dictionary = new Int32HashSet(); dictionary.Add(37); dictionary.Add(43); Assert.AreEqual(2, dictionary.Count); var clone = new Int32HashSet(dictionary); Assert.AreEqual(2, clone.Count); }
public void Equals() { Int32HashSet collection = new Int32HashSet(); collection.Add(1); collection.Add(2); collection.Add(3); Assert.IsTrue(_collection.Equals(collection)); collection.Add(37); Assert.IsFalse(_collection.Equals(collection)); }
public void AddRange() { var collection = new Int32HashSet(); collection.Add(4); collection.Add(5); Assert.Throws <NotSupportedException>(() => _readOnly.AddRange(collection)); _collection.AddRange(collection); Assert.AreEqual(5, _collection.Count); Assert.IsTrue(_collection.Contains(4)); Assert.IsTrue(_collection.Contains(5)); Assert.Throws <ArgumentException>(() => _collection.AddRange(collection)); }
public void TearDown() { _collection.Clear(); _collection = null; }