예제 #1
0
        public void RemoveNonExistentTest()
        {
            StringCollection col = new StringCollection();

            String test = "foo", test2 = "bar";
            col.Add(test);
            col.Add(test2);

            col.Remove("baz");
        }
예제 #2
0
        public void ThisTest()
        {
            StringCollection col = new StringCollection();
            String test = "foo", test2 = "bar";

            col.Add(test);
            col.Add(test2);

            Assert.AreEqual(test, col[0]);
            Assert.AreEqual(test2, col[1]);

            col[1] = test;
            Assert.AreEqual(test, col[1]);
        }
예제 #3
0
        public void RemoveTest()
        {
            StringCollection col = new StringCollection();

            String test = "foo", test2 = "bar";
            col.Add(test);
            col.Add(test2);

            col.RemoveAt(1);

            Assert.IsTrue(col.Contains(test));
            Assert.IsFalse(col.Contains(test2));

            col.Remove(test);

            Assert.IsFalse(col.Contains(test));
        }
예제 #4
0
        public void AddInsertTest()
        {
            StringCollection col = new StringCollection();

            String test = "foo";
            Assert.IsFalse(col.Contains(test));
            Assert.AreEqual(-1, col.IndexOf(test));

            col.Add(test);
            Assert.IsTrue(col.Contains(test));
            Assert.AreEqual(0, col.IndexOf(test));

            String test2 = "bar";

            col.Insert(0, test2);
            Assert.IsTrue(col.Contains(test2));
            Assert.AreEqual(0, col.IndexOf(test2));
            Assert.IsTrue(col.Contains(test));
            Assert.AreEqual(1, col.IndexOf(test));
        }