private void CommonStuff (CryptographicAttributeObjectCollection coll) { Assert.IsFalse (coll.IsSynchronized, "IsSynchronized"); Assert.AreSame (coll, coll.SyncRoot, "SyncRoot"); Assert.IsNotNull (coll.GetEnumerator (), "GetEnumerator"); int i = coll.Count; Oid o1 = new Oid ("1.2.840.113549.1.7.3"); AsnEncodedData aed = new AsnEncodedData (o1, new byte[] { 0x05, 0x00 }); Assert.AreEqual (i, coll.Add (aed), "Add(AsnEncodedData)"); Assert.IsTrue ((coll[i++] is CryptographicAttributeObject), "converted"); Oid o2 = new Oid ("1.2.840.113549.1.7.2"); CryptographicAttributeObject cao = new CryptographicAttributeObject (o2); Assert.AreEqual (i, coll.Add (cao), "Add(CryptographicAttributeObject)"); CryptographicAttributeObject[] array = new CryptographicAttributeObject [coll.Count]; coll.CopyTo (array, 0); Array a = (Array) new object [coll.Count]; ICollection c = (ICollection) coll; c.CopyTo (a, 0); IEnumerable e = (IEnumerable) coll; Assert.IsNotNull (e.GetEnumerator (), "GetEnumerator"); coll.Remove (cao); Assert.AreEqual (i, coll.Count, "Remove(CryptographicAttributeObject)"); }