コード例 #1
0
            public void InvokeNullCollectionLinqToEntities_Exception()
            {
                var sut       = new MinLengthSpecification <int[]>(0, true);
                var exception = Record.Exception(() => sut.GetExpression().Compile().Invoke(null));

                Assert.NotNull(exception);
                Assert.IsType <ArgumentNullException>(exception);
            }
コード例 #2
0
            public void InvokeValidCandidate_ReturnTrue <T>(T candidate, int minLength)
                where T : IEnumerable
            {
                var sut = new MinLengthSpecification <T>(minLength);

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

                Assert.True(result);
            }
コード例 #3
0
            public void NonGenericILinqSpecification_ReturnExpressionAsAbstractExpression()
            {
                var sut = new MinLengthSpecification <string>(0);

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

                Assert.Equal(expected, result);
            }
コード例 #4
0
            public void InvokeInvalidCandidate_ReturnFalse <T>(T candidate, int minLength)
                where T : IEnumerable
            {
                candidate = candidate?.ToString() != "null" ? candidate : default;
                var sut = new MinLengthSpecification <T>(minLength);

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

                Assert.False(result);
            }