コード例 #1
0
        public void Count_With_ReadOnlyList_ValueType(int expected)
        {
            // Arrange
            IEnumerable <int> source = TestReadOnlyList.ValueType(expected);

            // Act
            var result = source.Count();

            // Assert
            result.Should().Be(expected);
        }
コード例 #2
0
        public void Collections_Enumerable_FirstOrNone()
        {
            var full   = Enumerable.Range(0, 100);
            var empty  = Enumerable.Empty <int>();
            var single = Enumerable.Repeat(0, 1);

            FirstOperator(full, single, empty);

            var fullList   = Enumerable.Range(0, 100).ToList();
            var emptyList  = Enumerable.Empty <int>().ToList();
            var singleList = Enumerable.Repeat(0, 1).ToList();

            FirstOperator(fullList, singleList, emptyList);

            var fullReadOnlyList   = new TestReadOnlyList <int>(Enumerable.Range(0, 100).ToList());
            var emptyReadOnlyList  = new TestReadOnlyList <int>(Enumerable.Empty <int>().ToList());
            var singleReadOnlyList = new TestReadOnlyList <int>(Enumerable.Repeat(0, 1).ToList());

            FirstOperator(fullReadOnlyList, singleReadOnlyList, emptyReadOnlyList);
        }