public void ExpressionChain_Or_FiveArguments_Success()
        {
            Expression <Func <Person, bool> > f1 = x => x.Id > 0;
            Expression <Func <Person, bool> > f2 = x => x.Category == "CATEGORY 1";
            Expression <Func <Person, bool> > f3 = x => x.Name == "Dude";
            Expression <Func <Person, bool> > f4 = x => x.City == "LA";
            Expression <Func <Person, bool> > f5 = x => x.IsGolfer == true;
            Expression <Func <Person, bool> > mergedExpression = ExpressionChain.Or(f1, f2, f3, f4, f5);

            IQueryable <Person> mockups = new List <Person>
            {
                new Person {
                    Id = 0, Category = "CATEGORY 1", Name = "Duderino", City = "NY", IsGolfer = true
                },
                new Person {
                    Id = 1, Category = "CATEGORY 1", Name = "Dude", City = "LA", IsGolfer = true
                },
                new Person {
                    Id = 2, Category = "CATEGORY 1", Name = "Dude", City = "LA", IsGolfer = true
                },
                new Person {
                    Id = 3, Category = "CATEGORY 2", Name = "Dude", City = "LA", IsGolfer = true
                },
            }.AsQueryable();

            Assert.IsTrue(mockups.Where(mergedExpression).Count() == 4);
        }
        public void ExpressionChain_Or_OneArgument_ReturnsSame()
        {
            Expression <Func <Person, bool> > f1 = x => x.Id > 0;
            Expression <Func <Person, bool> > mergedExpression = ExpressionChain.Or(f1);

            Assert.IsTrue(mergedExpression == f1);
        }
        public void ExpressionChain_Or_ThreeArguments_Success()
        {
            Expression <Func <Person, bool> > f1 = x => x.Id > 0;
            Expression <Func <Person, bool> > f2 = x => x.Category == "CATEGORY 1";
            Expression <Func <Person, bool> > f3 = x => x.Name == "Dude";
            Expression <Func <Person, bool> > mergedExpression = ExpressionChain.Or(f1, f2, f3);

            IQueryable <Person> mockups = new List <Person>
            {
                new Person {
                    Id = 0, Category = "CATEGORY 1", Name = "Duderino"
                },
                new Person {
                    Id = 1, Category = "CATEGORY 1", Name = "Dude"
                },
                new Person {
                    Id = 2, Category = "CATEGORY 1", Name = "Dude"
                },
                new Person {
                    Id = 3, Category = "CATEGORY 2", Name = "Dude"
                },
            }.AsQueryable();

            Assert.IsTrue(mockups.Where(mergedExpression).Count() == 4);
        }
        public void ExpressionChain_Or_ArgumentNull_ThrowsArgumentNullException()
        {
            Expression <Func <Person, bool> >[] includes = null;
            ArgumentNullException ex = Assert.ThrowsException <ArgumentNullException>(() => ExpressionChain.Or(includes));

            Assert.AreEqual(ex.Message, "Value cannot be null. (Parameter 'expressions')");
        }