1: static void Main(string[] args) {
2: IApplicationContext _ctx = ContextRegistry.GetContext();
3:
4: IValidator _validator = (IValidator)_ctx.GetObject("PersonValidator");
5: ValidationErrors _errors1 = new ValidationErrors();
6: ValidationErrors _errors2 = new ValidationErrors();
7: ValidationErrors _errors3 = new ValidationErrors();
8: ValidationErrors _errors4 = new ValidationErrors();
9: ValidationErrors _errors5 = new ValidationErrors();
10: ValidationErrors _errors6 = new ValidationErrors();
11:
12: Person _p01 = new Person(1);
13: _p01.FirstName = "Matteo";
14: _p01.LastName = "Baglini";
15: _p01.DateOfBirth = new DateTime(1982, 11, 8);
16:
17: Person _p02 = new Person(2);
18: _p02.LastName = "Baglini";
19: _p02.DateOfBirth = new DateTime(1982, 11, 8);
20:
21: Person _p03 = new Person(3);
22: _p03.FirstName = "Matteo";
23: _p03.LastName = "Baglini";
24:
25: Person _p04 = new Person(4);
26: _p04.FirstName = "Matteo";
27: _p04.LastName = "Baglini";
28: _p04.DateOfBirth = new DateTime(1982, 11, 8);
29: _p04.AddressInfo.Address = "Via dei Sassi Sgonfi";
30:
31: Person _p05 = new Person(5);
32: _p05.FirstName = "Matteo";
33: _p05.LastName = "Baglini";
34: _p05.DateOfBirth = new DateTime(1982, 11, 8);
35: _p05.AddressInfo.Address = "Via dei Sassi Sgonfi";
36: _p05.AddressInfo.City = "Livorno";
37: _p05.AddressInfo.PostalCode = "57100";
38:
39: Person _p06 = new Person(6);
40: _p06.FirstName = "1234567890";
41: _p06.LastName = "Baglini";
42: _p06.DateOfBirth = new DateTime(1982, 11, 8);
43: _p06.AddressInfo.Address = "Via dei Sassi Sgonfi";
44: _p06.AddressInfo.City = "Livorno";
45: _p06.AddressInfo.PostalCode = "57100";
46:
47: Console.WriteLine(_p01.ToString());
48: Console.WriteLine("Is Valid? {0}", _validator.Validate(_p01, _errors1));
49: PrintErrors(_ctx,_errors1);
50:
51: Console.WriteLine();
52: Console.WriteLine(_p02.ToString());
53: Console.WriteLine("Is Valid? {0}", _validator.Validate(_p02, _errors2));
54: PrintErrors(_ctx, _errors2);
55:
56: Console.WriteLine();
57: Console.WriteLine(_p03.ToString());
58: Console.WriteLine("Is Valid? {0}", _validator.Validate(_p03, _errors3));
59: PrintErrors(_ctx, _errors3);
60:
61: Console.WriteLine();
62: Console.WriteLine(_p04.ToString());
63: Console.WriteLine("Is Valid? {0}", _validator.Validate(_p04, _errors4));
64: PrintErrors(_ctx, _errors4);
65:
66: Console.WriteLine();
67: Console.WriteLine(_p05.ToString());
68: Console.WriteLine("Is Valid? {0}", _validator.Validate(_p05, _errors5));
69: PrintErrors(_ctx, _errors5);
70:
71: Console.WriteLine();
72: Console.WriteLine(_p06.ToString());
73: Console.WriteLine("Is Valid? {0}", _validator.Validate(_p06, _errors6));
74: PrintErrors(_ctx, _errors6);
75:
76: Console.Read();
77: }