Beispiel #1
0
        public static void Remove()
        {
            CryptographicAttributeObject a0 = s_ca0;
            CryptographicAttributeObject a1 = s_ca1;
            CryptographicAttributeObject a2 = s_ca2;

            CryptographicAttributeObjectCollection c = new CryptographicAttributeObjectCollection();
            int index;

            index = c.Add(a0);
            Assert.Equal(0, index);
            index = c.Add(a1);
            Assert.Equal(1, index);
            index = c.Add(a2);
            Assert.Equal(2, index);

            c.Remove(a1);

            AssertEquals(c, new CryptographicAttributeObject[] { a0, a2 });
        }
        public void Remove_MultipleSameOid_First()
        {
            Oid o = new Oid(defaultOid);
            CryptographicAttributeObject           cao  = new CryptographicAttributeObject(o);
            CryptographicAttributeObjectCollection coll = new CryptographicAttributeObjectCollection(cao);

            Oid            o1  = new Oid(defaultOid);
            AsnEncodedData aed = new AsnEncodedData(o1, new byte[] { 0x04, (byte)0 });

            coll.Add(aed);

            aed = new AsnEncodedData(o1, new byte[] { 0x04, (byte)0 });
            coll.Add(aed);

            Oid o2 = new Oid(defaultOid);

            coll.Add(new CryptographicAttributeObject(o2));

            Assert.AreEqual(1, coll.Count, "before Remove");
            coll.Remove(cao);
            Assert.AreEqual(0, coll.Count, "after Remove");
        }
Beispiel #3
0
        public static void RemoveNegative()
        {
            CryptographicAttributeObjectCollection c = new CryptographicAttributeObjectCollection();

            Assert.Throws <ArgumentNullException>(() => c.Remove(null));
        }