public void ReadOnlyEmptyArrayTest()
        {
            var array = ReadOnlyColls.Empty <string>();

            array.ShouldNotBeNull();
            array.ShouldBeEmpty();
        }
        public void ReadOnlyCollOfListAndReturnsListWithGivenListSequenceTest()
        {
            var list0 = new List <int> {
                1, 2
            };
            var list1 = new List <int> {
                3, 4
            };
            var list2 = new List <int> {
                5
            };

            var listSrc = new List <List <int> > {
                list0, list1, list2
            }.ToArray();

            var list = ReadOnlyColls.OfList <int>(listSrc);

            list.ShouldNotBeNull();
            list.ShouldNotBeEmpty();
            list.Count.ShouldBe(5);
            list[0].ShouldBe(1);
            list[1].ShouldBe(2);
            list[2].ShouldBe(3);
            list[3].ShouldBe(4);
            list[4].ShouldBe(5);
        }
示例#3
0
        public void ReadOnlyAppendOneItemIntoCollTest()
        {
            var list = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 0
            }.AsReadOnly();

            var v = ReadOnlyColls.Append(list, 11);

            v.ShouldNotBeNull();
            v.Count.ShouldBe(11);
        }
        public void ReadOnlyCollsOfListWithGivenParamsTest()
        {
            var list = ReadOnlyColls.OfList(1, 2, 3, 4, 5);

            list.ShouldNotBeNull();
            list.ShouldNotBeEmpty();
            list.Count.ShouldBe(5);
            list[0].ShouldBe(1);
            list[1].ShouldBe(2);
            list[2].ShouldBe(3);
            list[3].ShouldBe(4);
            list[4].ShouldBe(5);
        }