public void When() { Expression <Func <Customer, bool> > expression = x => x.Age.HasValue; IEntityValidationRuleBuilder <Customer, string> ruleBuilder = Substitute.For <IEntityValidationRuleBuilder <Customer, string> >(); ruleBuilder.WhenForAnyArgs(x => x.SetSpecification(null)).Do(x => Assert.AreEqual(expression, x.Arg <ISpecification <Customer> >().Predicate)); EntityPropertyValidationRuleExtensions.When(ruleBuilder, expression); ruleBuilder.ReceivedWithAnyArgs(1).SetSpecification(null); }
public void BetweenForNullablePropertyMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.Between((IEntityValidationRuleBuilderInitial <Customer, int?>)null, 1, 10)); }
public void GreaterThanOrEqualToForNullablePropertyMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.GreaterThanOrEqualTo((IEntityValidationRuleBuilderInitial <Customer, int?>)null, 1)); }
public void PhoneNumberThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.PhoneNumber((IEntityValidationRuleBuilderInitial <Customer, string>)null)); }
public void LessThanOrEqualToMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.LessThanOrEqualTo((IEntityValidationRuleBuilderInitial <Customer, int>)null, 1)); }
public void UnlessMustThrowArgumentNullExceptionWhenPredicateIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.Unless(Substitute.For <IEntityValidationRuleBuilder <Customer, string> >(), null)); }
public void UnlessMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.Unless <Customer, string>(null, x => x.Age != null)); }
public void CreditCardMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.CreditCard <Customer>(null)); }
public void BetweenMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.Between((IEntityValidationRuleBuilderInitial <Customer, string>)null, "1", "2")); }
public void NotEqualToMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.NotEqualTo <Customer, string>(null, string.Empty, StringComparer.OrdinalIgnoreCase)); }
public void EmailAddressMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.EmailAddress <Customer>(null)); }
public void MatchesMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.Matches <Customer>(null, string.Empty, RegexOptions.Compiled)); }
public void ExactLengthMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.Length <Customer>(null, 10)); }
public void NotEmptyMustThrowArgumentNullExceptionWhenRuleBuilderIsNull() { Assert.Throws <ArgumentNullException>(() => EntityPropertyValidationRuleExtensions.NotEmpty <Customer, string>(null)); }