Ejemplo n.º 1
0
        public void InvokeCompositeIsType_ReturnIsTypeSpecification()
        {
            var expected = new IsTypeSpecification <int>(typeof(FakeType));

            var sut = new MockCompositeSpecification <int>().IsType(typeof(FakeType));

            Assert.Equal(expected, sut, new SpecificationComparer());
        }
Ejemplo n.º 2
0
        public void InvokeIsType_ReturnIsTypeSpecification()
        {
            var expected = new IsTypeSpecification <FakeType>(typeof(FakeType));

            var sut = Specification.IsType <FakeType>(typeof(FakeType));

            Assert.Equal(expected, sut, new SpecificationComparer());
        }
            public void InvokeInvalidCandidate_ReturnFalse <T>(T candidate, Type expected)
            {
                var sut = new IsTypeSpecification <T>(expected);

                var result = sut.GetExpression().Compile().Invoke(candidate);

                Assert.False(result);
            }
            public void InvalidCandidate_ReturnFalse <T>(T candidate, Type expected)
            {
                var sut = new IsTypeSpecification <T>(expected);

                var result = sut.IsNotSatisfiedBy(candidate);

                Assert.False(result);
            }
Ejemplo n.º 5
0
            public void ValidCandidate_ReturnTrue <T>(T candidate, Type expected)
            {
                var sut = new IsTypeSpecification <T>(expected);

                var result = sut.IsSatisfiedBy(candidate);

                Assert.True(result);
            }
            public void NonGenericILinqSpecification_ReturnExpressionAsAbstractExpression()
            {
                var sut = new IsTypeSpecification <FakeType>(typeof(object));

                var expected      = sut.GetExpression().ToString();
                var sutExpression = ((ILinqSpecification)sut).GetExpression();
                var result        = sutExpression.ToString();

                Assert.Equal(expected, result);
            }
            public void InvalidCandidate_ReturnExpectedResultObject <T>(T candidate, Type expected,
                                                                        SpecificationResult expResult)
            {
                var sut = new IsTypeSpecification <T>(expected);

                var overall = sut.IsNotSatisfiedBy(candidate, out var result);

                Assert.False(overall);
                Assert.Equal(expResult, result, new SpecificationResultComparer(candidate));
            }