Exemple #1
0
            public void ShouldBeAbleToEnumerateOverEnumerable_Typed()
            {
                // Arrange
                var data       = new[] { 1, 2, 3 };
                var firstLayer = new MyEnumerable <int>(data);
                var sut        = new EnumerableWrapper <int>(firstLayer);

                // Act
                Expect(sut.IsValid).To.Be.True();
                var result = sut.ToList();

                // Assert
                Expect(result).To.Equal(data);
            }
Exemple #2
0
            public void ShouldBeAbleToEnumerate()
            {
                // Arrange
                var data       = new[] { 1, 2, 3 };
                var enumerable = new MyEnumerable <int>(data);
                var collector  = new List <int>();

                // Act
                foreach (var item in enumerable)
                {
                    collector.Add((int)item);
                }

                // Assert
                Expect(collector).To.Equal(data);
            }
Exemple #3
0
            public void ShouldBeAbleToEnumerateOverEnumerable()
            {
                // Arrange
                var data       = new[] { 1, 2, 3 };
                var collector  = new List <int>();
                var firstLayer = new MyEnumerable <int>(data);
                var sut        = new EnumerableWrapper(firstLayer);

                // Act
                Expect(sut.IsValid).To.Be.True();
                foreach (var item in sut)
                {
                    collector.Add((int)item);
                }

                // Assert
                Expect(collector).To.Equal(data);
            }