public void InvokeMaxLength_ReturnMaxLengthSpecification() { var expected = new MaxLengthSpecification <FakeType>(0, true); var sut = Specification.MaxLength <FakeType>(0); Assert.Equal(expected, sut, new SpecificationComparer()); }
public void InvokeNullCollectionLinqToEntities_Exception() { var sut = new MaxLengthSpecification <int[]>(0, true); var exception = Record.Exception(() => sut.GetNegationExpression().Compile().Invoke(null)); Assert.NotNull(exception); Assert.IsType <ArgumentNullException>(exception); }
public void NullCollectionLinqToEntities_Exception() { var sut = new MaxLengthSpecification <int[]>(0, true); var exception = Record.Exception(() => sut.IsSatisfiedBy(null)); Assert.NotNull(exception); Assert.IsType <ArgumentNullException>(exception); }
public void InvokeCompositeMaxLength_ReturnMaxLengthSpecification() { var expected = new MaxLengthSpecification <string>(0, true); var sut = new MockCompositeSpecification <string>().MaxLength(0); Assert.Equal(expected, sut, new SpecificationComparer()); }
public void InvokeInvalidCandidate_ReturnFalse <T>(T candidate, int maxLength) where T : IEnumerable { var sut = new MaxLengthSpecification <T>(maxLength); var result = sut.GetNegationExpression().Compile().Invoke(candidate); Assert.False(result); }
public void ValidCandidate_ReturnTrue <T>(T candidate, int maxLength) where T : IEnumerable { var sut = new MaxLengthSpecification <T>(maxLength); var result = sut.IsSatisfiedBy(candidate); Assert.True(result); }
public void InvokeValidCandidate_ReturnTrue <T>(T candidate, int maxLength) where T : IEnumerable { candidate = candidate?.ToString() != "null" ? candidate : default; var sut = new MaxLengthSpecification <T>(maxLength); var result = sut.GetNegationExpression().Compile().Invoke(candidate); Assert.True(result); }
public void InvalidCandidate_ReturnFalse <T>(T candidate, int maxLength) where T : IEnumerable { candidate = candidate?.ToString() != "null" ? candidate : default; var sut = new MaxLengthSpecification <T>(maxLength); var result = sut.IsSatisfiedBy(candidate); Assert.False(result); }
public void NonGenericILinqSpecification_ReturnExpressionAsAbstractExpression() { var sut = new MaxLengthSpecification <string>(0); var expected = sut.GetExpression().ToString(); var sutExpression = ((ILinqSpecification)sut).GetExpression(); var result = sutExpression.ToString(); Assert.Equal(expected, result); }
public void ValidCandidate_ReturnExpectedResultObject <T>(T candidate, int maxLength, SpecificationResult expected) where T : IEnumerable { var sut = new MaxLengthSpecification <T>(maxLength); var overall = sut.IsSatisfiedBy(candidate, out var result); Assert.True(overall); Assert.Equal(expected, result, new SpecificationResultComparer()); }
public void InvalidCandidate_ReturnExpectedResultObject <T>(T candidate, int maxLength, SpecificationResult expected) where T : IEnumerable { candidate = candidate?.ToString() != "null" ? candidate : default; var sut = new MaxLengthSpecification <T>(maxLength); var overall = sut.IsSatisfiedBy(candidate, out var result); Assert.False(overall); Assert.Equal(expected, result, new SpecificationResultComparer()); }