public void TestValidate_IdIsEmpty() { AssertHelper.Throws <Warning>(() => { _sample = AggregateRootSample.CreateSample(Guid.Empty); _sample.Validate(); }, "Id"); }
public void TestValidate_Required() { AssertHelper.Throws <Warning>(() => { _sample.Name = null; _sample.Validate(); }, "姓名不能为空"); }
public void TestSetValidationHandler() { _sample = AggregateRootSample.CreateSample(); _sample.Name = "abcd"; _sample.AddValidationRule(new ValidationRuleSample(_sample)); _sample.SetValidationHandler(new ValidationHandlerSample()); _sample.Validate(); }
public void Test_SetValidationHandler() { _sample = AggregateRootSample.CreateSample(); _sample.Name = "abcd"; _sample.AddStrategy(new ValidateStrategySample()); _sample.SetValidateHandler(new ValidationHandlerSample()); _sample.Validate(); }
public void TestAddValidationRule() { _sample = AggregateRootSample.CreateSample(); AssertHelper.Throws <Warning>(() => { _sample.Name = "abcd"; _sample.AddValidationRule(new ValidationRuleSample(_sample)); _sample.Validate(); }, "名称长度不能大于3"); }