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

Where_IEnumerable_ExecutionIsDeferred() private method

private Where_IEnumerable_ExecutionIsDeferred ( ) : void
return void
        public void Where_IEnumerable_ExecutionIsDeferred()
        {
            bool funcCalled = false;
            IEnumerable<Func<bool>> source = Enumerable.Repeat((Func<bool>)(() => { funcCalled = true; return true; }), 1);

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

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