Beispiel #1
0
        public void CheckContains()
        {
            var localList = new LocalList <Boo>(_items);

            localList.Contains(_items[0]).Should().BeTrue();
            localList.Contains(new Boo(), EqualityComparer <Boo> .Default).Should().BeFalse();
        }
Beispiel #2
0
        public void AddValue <T>(T item)
        {
            var localList = new LocalList <T>();

            localList.Add(item);

            localList.Contains(item).Should().BeTrue();
        }
Beispiel #3
0
        public void AddRangeFromLocalList(Boo[] items)
        {
            var localList = new LocalList <Boo>();

            localList.AddRange(new LocalList <Boo>(items));

            foreach (var item in items)
            {
                localList.Contains(item).Should().BeTrue();
            }

            localList.Length.Should().Be(items.Length);
        }
Beispiel #4
0
        public void AddRangeFromArray()
        {
            var localList = new LocalList <Boo>();

            localList.AddRange(_items);

            foreach (var item in _items)
            {
                localList.Contains(item).Should().BeTrue();
            }

            localList.Length.Should().Be(_items.Length);
        }
Beispiel #5
0
        public void AddMany(int count)
        {
            var localList = new LocalList <int>();

            var items = Many(EnsureValid(count), i => i);

            foreach (var item in items)
            {
                localList.Add(item);
                localList.Contains(item).Should().BeTrue();
            }

            localList.Length.Should().Be(items.Length);
        }
Beispiel #6
0
        public void InitializeFromItems()
        {
            var list1 = new LocalList <int>(item0: 1);

            list1.Contains(1).Should().BeTrue();
            list1.Length.Should().Be(1);

            var list2 = new LocalList <int>(1, 2);

            list2.Contains(1).Should().BeTrue();
            list2.Contains(2).Should().BeTrue();
            list2.Length.Should().Be(2);

            var list3 = new LocalList <int>(1, 2, 3);

            list3.Contains(1).Should().BeTrue();
            list3.Contains(2).Should().BeTrue();
            list3.Contains(3).Should().BeTrue();
            list3.Length.Should().Be(3);

            var list4 = new LocalList <int>(1, 2, 3, 4);

            list4.Contains(1).Should().BeTrue();
            list4.Contains(2).Should().BeTrue();
            list4.Contains(3).Should().BeTrue();
            list4.Contains(4).Should().BeTrue();
            list4.Length.Should().Be(4);

            var list5 = new LocalList <int>(1, 2, 3, 4, 5);

            list5.Contains(1).Should().BeTrue();
            list5.Contains(2).Should().BeTrue();
            list5.Contains(3).Should().BeTrue();
            list5.Contains(4).Should().BeTrue();
            list5.Contains(5).Should().BeTrue();
            list5.Length.Should().Be(5);
        }