public void CorrectNegatableSpecification_ReturnIsNotSatisfiedByExecutionInExpression()
            {
                var specification = MockNegatableSpecification.True();
                var sut           = new SpecificationAdapter <object>(specification);

                var expression = sut.GetNegationExpression();
                var result     = expression.ToString();

                Assert.Matches(@"candidate => .*.IsNotSatisfiedBy\(candidate\)", result);
            }
            public void CorrectLinqSpecification_ReturnBaseNegationExpression()
            {
                Expression <Func <object, bool> > expected = obj => false;
                var specification = new MockLinqSpecification <object>(obj => true, expected);
                var sut           = new SpecificationAdapter <object>(specification);

                var result = sut.GetNegationExpression();

                Assert.Equal(expected, result);
            }
            public void InvokeNull_NotRaiseException(bool isNegatable)
            {
                var specification = isNegatable
                    ? new MockLinqSpecification <object>(obj => true, obj => false)
                    : MockSpecification.True();
                var sut = new SpecificationAdapter <object>(specification);

                var exception = Record.Exception(() => sut.GetNegationExpression().Compile().Invoke(null));

                Assert.Null(exception);
            }
            public void InvokeFalseSpecification_ReturnFalse(bool isNegatable)
            {
                var specification = isNegatable
                    ? new MockLinqSpecification <object>(obj => true, obj => false)
                    : MockSpecification.True();
                var sut = new SpecificationAdapter <object>(specification);

                var result = sut.GetNegationExpression().Compile().Invoke(new object());

                Assert.False(result);
            }
            public void InvokeRelatedNegatableTypes_NoException()
            {
                var specification = new MockLinqSpecification <IEnumerable <char> >(obj => true, obj => false);

                var exception = Record.Exception(() =>
                {
                    var sut = new SpecificationAdapter <ChildFakeType>(specification);
                    sut.GetNegationExpression().Compile().Invoke(new ChildFakeType());
                });

                Assert.Null(exception);
            }