예제 #1
0
        public void GetEnumerator_CollectionWithMultipleElements_ReturnsCollectionWithAllTheElementsThatHasTheSameLengthAsTheLongestElement()
        {
            var collection = new List <string>
            {
                "A",
                "BBBB",
                "CCC",
                "DDDD",
                "EEE",
                "FFFF",
                "GG",
                "H",
                "IIII",
                "J"
            };

            var output = new AllWithMinEnumerable <string, int>(collection, s => s?.Length ?? 0).ToList();

            CollectionAssert.AreEqual(new[]
            {
                "A",
                "H",
                "J",
            }, output);
        }
예제 #2
0
        public void GetEnumerator_EmptyCollection_ReturnsEmptyResult()
        {
            var collection = new List <string>();

            var output = new AllWithMinEnumerable <string, int>(collection, s => s?.Length ?? 0).ToList();

            Assert.That(output, Is.Empty);
        }
예제 #3
0
        public void GetEnumerator_CollectionWithOneElement_ReturnsCollectionWithThatElement()
        {
            var collection = new List <string>
            {
                "AAA"
            };

            var output = new AllWithMinEnumerable <string, int>(collection, s => s?.Length ?? 0).ToList();

            CollectionAssert.AreEqual(collection, output);
        }
예제 #4
0
        public void GetEnumerator_CollectionWithTwoElementsOfDifferentLengths_ReturnsCollectionWithTheLongestElement()
        {
            var collection = new List <string>
            {
                "AAA",
                "BBBB",
            };

            var output = new AllWithMinEnumerable <string, int>(collection, s => s?.Length ?? 0).ToList();

            CollectionAssert.AreEqual(new[]
            {
                "AAA"
            }, output);
        }