public void NullableCandidate_ReturnFalse(int?candidate, int?greaterThan) { var sut = new GreaterThanOrEqualSpecification <int?>(greaterThan); var result = sut.IsNotSatisfiedBy(candidate); Assert.False(result); }
public void GreaterThanOrEqualCandidate_ReturnFalse <T>(T candidate, T greaterThan, IComparer <T> comparer) { candidate = candidate?.ToString() != "null" ? candidate : default; var sut = new GreaterThanOrEqualSpecification <T>(greaterThan, comparer); var result = sut.IsNotSatisfiedBy(candidate); Assert.False(result); }
public void CorrectNullableCandidate_ReturnExpectedResultObject(int?candidate, int?greaterThan, SpecificationResult expected) { var sut = new GreaterThanOrEqualSpecification <int?>(greaterThan); var overall = sut.IsNotSatisfiedBy(candidate, out var result); Assert.True(overall); Assert.Equal(expected, result, new SpecificationResultComparer()); }
public void GreaterThanOrEqualCandidate_ReturnExpectedResultObject <T>(T candidate, T greaterThan, IComparer <T> comparer, SpecificationResult expected) { candidate = candidate?.ToString() != "null" ? candidate : default; var sut = new GreaterThanOrEqualSpecification <T>(greaterThan, comparer); var overall = sut.IsNotSatisfiedBy(candidate, out var result); Assert.False(overall); Assert.Equal(expected, result, new SpecificationResultComparer(candidate)); }
protected BaseBetweenSpecification(T from, T to, bool inclusive, IComparer<T> comparer) { From = from; To = to; if (inclusive) { _lessThanSpecification = new LessThanOrEqualSpecification<T>(to, comparer); _greaterThanSpecification = new GreaterThanOrEqualSpecification<T>(from, comparer); } else { _lessThanSpecification = new LessThanSpecification<T>(to, comparer); _greaterThanSpecification = new GreaterThanSpecification<T>(from, comparer); } var fromGreaterThanSpec = new GreaterThanOrEqualSpecification<T>(from, comparer); if (fromGreaterThanSpec.IsNotSatisfiedBy(to)) throw new ArgumentException("To must be greater than From", nameof(to)); }