Пример #1
0
 public void TestValidate_IdIsEmpty()
 {
     AssertHelper.Throws <Warning>(() => {
         _sample = AggregateRootSample.CreateSample(Guid.Empty);
         _sample.Validate();
     }, "Id");
 }
Пример #2
0
 public void TestSetValidationHandler()
 {
     _sample      = AggregateRootSample.CreateSample();
     _sample.Name = "abcd";
     _sample.AddValidationRule(new ValidationRuleSample(_sample));
     _sample.SetValidationHandler(new ValidationHandlerSample());
     _sample.Validate();
 }
Пример #3
0
 public void Test_SetValidationHandler()
 {
     _sample      = AggregateRootSample.CreateSample();
     _sample.Name = "abcd";
     _sample.AddStrategy(new ValidateStrategySample());
     _sample.SetValidateHandler(new ValidationHandlerSample());
     _sample.Validate();
 }
Пример #4
0
 public void TestAddValidationRule()
 {
     _sample = AggregateRootSample.CreateSample();
     AssertHelper.Throws <Warning>(() => {
         _sample.Name = "abcd";
         _sample.AddValidationRule(new ValidationRuleSample(_sample));
         _sample.Validate();
     }, "名称长度不能大于3");
 }
Пример #5
0
 /// <summary>
 ///     测试初始化
 /// </summary>
 public PagerListTest()
 {
     _list = new PagerList <AggregateRootSample>(1, 2, 3, "Name");
     _list.Add(AggregateRootSample.CreateSample());
     _list.Add(AggregateRootSample.CreateSample2());
 }
Пример #6
0
 /// <summary>
 ///     测试初始化
 /// </summary>
 public DataAnnotationValidationTest()
 {
     _sample = AggregateRootSample.CreateSample();
 }
Пример #7
0
 /// <summary>
 /// 测试初始化
 /// </summary>
 public ValidationTest()
 {
     _sample     = AggregateRootSample.CreateSample();
     _validation = ValidationFactory.Create();
 }