Пример #1
0
        public static void TestOptionValueCollectionIndexOf()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Add("Second");

            Assert.That(ovc.IndexOf("Second"), Is.EqualTo(1));
        }
Пример #2
0
        public static void TestOptionValueCollectionContains()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Add("second");

            Assert.That(ovc.Contains("first"));
            Assert.That(ovc.Contains("first"));
            Assert.That(ovc.Contains("third"), Is.False);
        }
Пример #3
0
        public static void TestOptionValueCollectionRemoveAt()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Add("second");

            ovc.RemoveAt(0);

            Assert.That(ovc.Count, Is.EqualTo(1));
            Assert.That(ovc[0], Is.EqualTo("second"));
        }
Пример #4
0
        public static void TestOptionValueCollectionToList()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Add("second");

            List <string> list = ovc.ToList();

            Assert.That(list.Count, Is.EqualTo(2));
            Assert.That(list[0], Is.EqualTo("first"));
            Assert.That(list[1], Is.EqualTo("second"));
        }
Пример #5
0
        public static void TestOptionValueCollectionToArray()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Add("second");

            string[] array = ovc.ToArray();

            Assert.That(array.Length, Is.EqualTo(2));
            Assert.That(array[0], Is.EqualTo("first"));
            Assert.That(array[1], Is.EqualTo("second"));
        }
Пример #6
0
        public static void TestOptionValueCollectionCopyTo()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Add("second");

            string[] array = new string[] { "one", "two", "three" };
            ovc.CopyTo(array, 1);

            Assert.That(array.Length, Is.EqualTo(3));
            Assert.That(array[0], Is.EqualTo("one"));
            Assert.That(array[1], Is.EqualTo("first"));
            Assert.That(array[2], Is.EqualTo("second"));
        }
Пример #7
0
        public static void TestOptionValueCollectionGetEnumerator()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Add("second");

            string v = String.Empty;

            foreach (string s in ovc)
            {
                v += s;
            }
            Assert.That(v, Is.EqualTo("firstsecond"));
        }
Пример #8
0
        public static void TestOptionValueCollectionItemSetter()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc[0] = "value";

            Assert.That(ovc[0], Is.EqualTo("value"));
        }
Пример #9
0
        public static void TestOptionValueCollectionInsert()
        {
            OptionValueCollection ovc = CreateOptionValueCollection();

            ovc.Add("first");
            ovc.Insert(0, "half");

            Assert.That(ovc.Count, Is.EqualTo(2));
            Assert.That(ovc[0], Is.EqualTo("half"));
            Assert.That(ovc[1], Is.EqualTo("first"));
        }