public void Constructor_FromEnumerable()
        {
            var lazy = new LazyCollection <int>(_Int32TestData);

            lazy.Should().NotBeNull();
            lazy.Count.Should().Be(5);
            lazy.IsReadOnly.Should().BeFalse();
        }
        public void Constructor_ThreadSafetyMode()
        {
            // ReSharper disable once CollectionNeverUpdated.Local
            var lazy = new LazyCollection <int>(LazyThreadSafetyMode.ExecutionAndPublication);

            lazy.Should().NotBeNull();
            lazy.Count.Should().Be(0);
            lazy.IsReadOnly.Should().BeFalse();
        }
        public void Constructor_FromFactory()
        {
            // ReSharper disable once CollectionNeverUpdated.Local
            var lazy = new LazyCollection <int>(() => _Int32TestData.ToList());

            lazy.Should().NotBeNull();
            lazy.Count.Should().Be(5);
            lazy.IsReadOnly.Should().BeFalse();
        }
        public void Constructor()
        {
            // ReSharper disable once CollectionNeverUpdated.Local
            var lazy = new LazyCollection <int>();

            lazy.Should().NotBeNull();
            lazy.Count.Should().Be(0);
            lazy.IsReadOnly.Should().BeFalse();
        }
        public void Contains()
        {
            // Arrange
            var lazy = new LazyCollection <int>(_Int32TestData);

            lazy.Should().NotBeNull();

            // Assert
            lazy.Contains(0).Should().BeTrue();
            lazy.Contains(101).Should().BeFalse();
        }
        public void CopyTo()
        {
            // Arrange
            var buffer = new int[5];

            var lazy = new LazyCollection <int>(_Int32TestData);

            lazy.Should().NotBeNull();

            // Act
            lazy.CopyTo(buffer, 0);

            buffer.Should().BeEquivalentTo(_Int32TestData);
        }
        public void Enumerate()
        {
            // Arrange
            var list = new List <object>(8);

            var lazy = new LazyCollection <int>(_Int32TestData);

            lazy.Should().NotBeNull();

            foreach (var i in (IEnumerable)lazy)
            {
                list.Add(i);
            }

            list.OfType <int>().Count().Should().Be(5);
            list.OfType <int>().Should().BeEquivalentTo(_Int32TestData);
        }
        public void Add_Remove_Clear()
        {
            // Arrange
            var lazy = new LazyCollection <int>(_Int32TestData);

            lazy.Should().NotBeNull();
            lazy.Count.Should().Be(5);
            lazy.IsReadOnly.Should().BeFalse();

            lazy.Remove(Int32.MinValue);
            lazy.Count.Should().Be(4);

            lazy.Add(Int32.MinValue);
            lazy.Add(101);
            lazy.Count.Should().Be(6);

            lazy.Clear();
            lazy.Count.Should().Be(0);
        }