public override IQueryable <T> SatisfyingEntitiesFrom(IQueryable <T> query)
        {
            var combinedPredicates = LeftSpecification.GetAllPredicates();

            return(query.Where(combinedPredicates.Or(RightSpecification.Predicate)));

            //return query.Where(_leftSpecification.predicate.Or(_rightSpecification.predicate));
        }
Exemple #2
0
            public void LeftSpecificationIsFalse()
            {
                SetLeftAndRightExpressionsResults(false, true);

                var isValid = LeftSpecification.And(RightSpecification).IsSatisfiedBy(new Person());

                isValid.Should().BeFalse();

                CheckCallTosOfLeftAndRightExpressions(Repeated.Exactly.Once, Repeated.Never);
            }
Exemple #3
0
            public void BothAndedSpecificationsAreTrue()
            {
                SetLeftAndRightExpressionsResults(true, true);

                var isValid = LeftSpecification.And(RightSpecification).IsSatisfiedBy(new Person());

                isValid.Should().BeTrue();

                CheckCallTosOfLeftAndRightExpressions(Repeated.Exactly.Once, Repeated.Exactly.Once);
            }
Exemple #4
0
            public void OrLeftAndRightSideAreFalse()
            {
                SetLeftAndRightExpressionsResults(false, false);

                var isValid = LeftSpecification.Or(RightSpecification).IsSatisfiedBy("Deadpool");

                isValid.Should().BeFalse();

                CheckCallTosOfLeftAndRightExpressions(Repeated.Exactly.Once, Repeated.Exactly.Once);
            }
Exemple #5
0
            public void OrRightIsTrueOnly()
            {
                SetLeftAndRightExpressionsResults(false, true);

                var isValid = LeftSpecification.Or(RightSpecification).IsSatisfiedBy("Greens n' such.");

                isValid.Should().BeTrue();

                CheckCallTosOfLeftAndRightExpressions(Repeated.Exactly.Once, Repeated.Exactly.Once);
            }
Exemple #6
0
            public void OrLeftIsTrueOnly()
            {
                SetLeftAndRightExpressionsResults(true, false);

                var isValid = LeftSpecification.Or(RightSpecification).IsSatisfiedBy("Zeplin");

                isValid.Should().BeTrue();

                CheckCallTosOfLeftAndRightExpressions(Repeated.Exactly.Once, Repeated.Never);
            }
            public void NotTheResults()
            {
                SetLeftAndRightExpressionsResults(true, false);

                var leftNottedSpecification = LeftSpecification.Not();

                leftNottedSpecification.Should().NotBeNull();

                var isLeftValid = leftNottedSpecification.IsSatisfiedBy('A');

                isLeftValid.Should().BeFalse();

                var rightNottedSpecification = RightSpecification.Not();

                rightNottedSpecification.Should().NotBeNull();

                var isRightValid = rightNottedSpecification.IsSatisfiedBy('Z');

                isRightValid.Should().BeTrue();

                CheckCallTosOfLeftAndRightExpressions(Repeated.Exactly.Once, Repeated.Exactly.Once);
            }
Exemple #8
0
 public override bool IsSatisfiedBy(T entity)
 {
     return(LeftSpecification.IsSatisfiedBy(entity) && RightSpecification.IsSatisfiedBy(entity));
 }
Exemple #9
0
 public override Expression <Func <T, bool> > GetAllPredicates()
 {
     return(LeftSpecification.GetAllPredicates().And(RightSpecification.Predicate));
 }
 public bool IsSatisfiedBy(TEntity candidate)
 {
     return(LeftSpecification.IsSatisfiedBy(candidate) || RightSpecification.IsSatisfiedBy(candidate));
 }
 public async Task <bool> IsSatisfiedByAsync(TEntity candidate)
 {
     return(await LeftSpecification.IsSatisfiedByAsync(candidate) || await RightSpecification.IsSatisfiedByAsync(candidate));
 }