public override void Define() { CustomerEntity customer = null; When().Match(() => customer, l => !string.IsNullOrEmpty(l.Name)); Then().Do(c => customer.Validate()); }
public void Validate_with_zero_should_be_valid() { var target = new CustomerEntity { Id = 0, Name = "Mat" }; Assert.IsTrue(target.Validate()); }
public void Validate_with_negative_integer_should_be_invalid() { var target = new CustomerEntity { Id = -1, Name = "Mat" }; Assert.IsFalse(target.Validate()); Assert.IsTrue(target.ValidationErrors.Count > 0); }
public void Validate_with_positive_integer_should_be_valid() { var target = new CustomerEntity { Id = 12, Name = "Mat" }; Assert.IsTrue(target.Validate()); Assert.IsTrue(target.ValidationErrors.Count == 0); }