Пример #1
0
            public void InvokeRelatedNegatableTypes_NoException()
            {
                var specification = MockNegatableComplexSpecification <IEnumerable <char> > .True();

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

                Assert.Null(exception);
            }
Пример #2
0
            public void InvokeIncorrectData_ReturnTrue(bool isNegatable)
            {
                var specification = !isNegatable
                    ? MockComplexSpecification.True()
                    : MockNegatableComplexSpecification.True();

                var sut = new NotSpecification <object>(specification);

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

                Assert.False(result);
            }
            public void IncorrectData_ReturnFalse(bool isNegatable)
            {
                var specification = !isNegatable
                    ? MockComplexSpecification.True()
                    : MockNegatableComplexSpecification.True();

                var sut = new NotSpecification <object>(specification);

                var result = sut.IsSatisfiedBy(new object());

                Assert.False(result);
            }
            public void RelatedNegatableTypes_NoException()
            {
                var specification = MockNegatableComplexSpecification <IEnumerable <char> > .True();

                var exception = Record.Exception(() =>
                {
                    var sut = new NotSpecification <ChildFakeType>(specification);
                    sut.IsSatisfiedBy(new ChildFakeType());
                });

                Assert.Null(exception);
            }
            public void IncorrectData_ReturnExpectedResultObject(bool isNegatable, SpecificationResult expected)
            {
                var specification = !isNegatable
                    ? MockComplexSpecification.True()
                    : MockNegatableComplexSpecification.True();

                var sut = new NotSpecification <object>(specification);
                var dum = new object();

                var overall = sut.IsSatisfiedBy(dum, out var result);

                Assert.False(overall);
                Assert.Equal(expected, result, new SpecificationResultComparer(dum));
            }