예제 #1
0
        public void CreateStaticListFromCollection()
        {
            //Arrange
            var collection = new int[] { 1, 2, 3, 4 };

            //Act
            var list   = new StaticList <int>(collection);
            var result = list.ToArray();

            //Assert
            CollectionAssert.AreEqual(collection, result);
        }
예제 #2
0
        public void StaticListAddsCorrectly()
        {
            //Arrange
            var list = new StaticList <int>();

            //Act
            list.Add(1);
            list.Add(2);
            var array = list.ToArray();

            //Assert
            CollectionAssert.Contains(array, 1);
            CollectionAssert.Contains(array, 2);
        }
예제 #3
0
        public void StaticListChangeValueWithBracketsWorksCorrectly()
        {
            //Arrange
            var list     = new StaticList <int>(5);
            var expected = new int[] { 2, 3 };

            list.Add(8);
            list.Add(7);

            //Act
            list[0] = 1;
            list[1] = 3;
            list[0] = 2;
            var result = list.ToArray();

            //Assert
            CollectionAssert.AreEqual(expected, result);
        }
예제 #4
0
        public void StaticListRemoveWorksCorrectly()
        {
            //Arrange
            var list     = new StaticList <int>();
            var expected = new int[] { 8, 7, 3, 1, 6 };

            //Act
            list.Add(8);
            list.Add(7);
            list.Add(11);
            list.Add(3);
            list.Add(1);
            list.Add(6);

            list.Remove(11);
            var result = list.ToArray();

            //Assert
            CollectionAssert.AreEqual(expected, result);
        }