System.Linq.Tests.WhereTests.WhereWhere_IReadOnlyCollection_ExecutionIsDeferred C# (CSharp) Method

WhereWhere_IReadOnlyCollection_ExecutionIsDeferred() private method

        public void WhereWhere_IReadOnlyCollection_ExecutionIsDeferred()
        {
            bool funcCalled = false;
            IReadOnlyCollection<Func<bool>> source = new ReadOnlyCollection<Func<bool>>(new List<Func<bool>>() { () => { funcCalled = true; return true; } });

            IEnumerable<Func<bool>> query = source.Where(value => value()).Where(value => value());
            Assert.False(funcCalled);

            query = source.Where((value, index) => value());
            Assert.False(funcCalled);
        }
WhereTests