Example #1
0
        public void NewCollectionUsingNewListsAddsValues()
        {
            var collection = new StubCollection(new List <int> {
                1, 2, 3
            });

            collection.Count.Should().Be(3);
        }
Example #2
0
        public void NewCollectionUsingExistingCollectionAddsValues()
        {
            var collection1 = new StubCollection(new List <int> {
                1, 2, 3
            });
            var collection2 = new StubCollection(collection1);

            collection2.Count.Should().Be(3);
        }
Example #3
0
        public void UsingAddRangeAddsValues()
        {
            var collection1 = new StubCollection(new List <int> {
                1, 2, 3
            });
            var collection2 = new StubCollection();

            collection2.AddRange(collection1);
            collection2.Count.Should().Be(3);
        }
Example #4
0
        public void AddRangeThrowsWhenCollectionIsNull()
        {
            Action act = () =>
            {
                var collection = new StubCollection();
                collection.AddRange(null);
            };

            act.ShouldThrow <ArgumentNullException>().Where(x => x.Message.Contains("Parameter collection is null"));
        }
Example #5
0
        public void SortIntsSorts()
        {
            var ints = new StubCollection {
                3, 2, 1
            };

            ints.Sort(null);
            ints[0].Should().Be(1);
            ints[1].Should().Be(2);
            ints[2].Should().Be(3);
        }