Example #1
0
        public void AddIndex_WithStartIndexSpecified_ProducesCorrectResults()
        {
            IEnumerable <string> collection = new[]
            {
                "A", "B", "C"
            };

            var output = CollectionExtensions.AddIndex(collection, 42);

            CollectionAssert.AreEqual(new[]
            {
                new IndexedElement <string>(42, "A"),
                new IndexedElement <string>(43, "B"),
                new IndexedElement <string>(44, "C")
            }, output);
        }
Example #2
0
        public void AddIndex_NullCollection_ThrowsArgumentNullException()
        {
            IEnumerable <int> collection = null;

            Assert.Throws <ArgumentNullException>(() => CollectionExtensions.AddIndex(collection));
        }