コード例 #1
0
        public void GetElementThrowTest()
        {
            var list = new VSArray <int>(new[] { 1, 2, 3 });

            Assert.Throws(typeof(ArgumentOutOfRangeException), () => list.GetElement(-1));
            Assert.Throws(typeof(ArgumentOutOfRangeException), () => list.GetElement(8));
        }
コード例 #2
0
        public void SetElementTest()
        {
            var list = new VSArray <int>(new[] { 1, 2, 3, 4, 5, 6 });

            list.SetElement(0, 10);
            Assert.That(list.GetElement(0), Is.EqualTo(10));

            list.SetElement(3, 10);
            Assert.That(list.GetElement(3), Is.EqualTo(10));
        }
コード例 #3
0
        public void AddElementTest()
        {
            var list = new VSArray <char>(new[] { 'a', 'b', 'c', 'd', 'e' });

            Assert.That(list.GetElementCount(), Is.EqualTo(5));

            list.AddElement('f');
            Assert.That(list.GetElementCount(), Is.EqualTo(6));
            Assert.That(list.GetElement(5), Is.EqualTo('f'));
        }