public void TestRemoveAt() { TVerificationResult res0, res1, res2, res3; TVerificationResultCollection coll = new TVerificationResultCollection(); res0 = new TVerificationResult(null, "test0", TResultSeverity.Resv_Noncritical); coll.Add(res0); res1 = new TVerificationResult(null, "test1", TResultSeverity.Resv_Noncritical); coll.Add(res1); res2 = new TVerificationResult(null, "test2", TResultSeverity.Resv_Noncritical); coll.Add(res2); res3 = new TVerificationResult(null, "test3", TResultSeverity.Resv_Noncritical); coll.Add(res3); // RemoveAt(index) Assert.Throws(typeof(ArgumentOutOfRangeException), delegate { coll.RemoveAt(4); }, "there is no verification result at index 4"); // remove from the middle coll.RemoveAt(1); Assert.AreEqual(res0, coll.FindBy(0), "res0 should be at position 0"); Assert.AreEqual(res2, coll.FindBy(1), "res2 should be at position 1"); Assert.AreEqual(res3, coll.FindBy(2), "res3 should be at position 2"); // remove from the front coll.RemoveAt(0); Assert.AreEqual(res2, coll.FindBy(0), "res2 should be at position 0"); Assert.AreEqual(res3, coll.FindBy(1), "res3 should be at position 1"); // remove from the back coll.RemoveAt(1); Assert.AreEqual(res2, coll.FindBy(0), "res2 should be at position 0"); Assert.AreEqual(1, coll.Count, "only one element should be left"); }