1- using Microsoft . VisualStudio . TestTools . UnitTesting ;
1+ using System ;
2+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
23using ObjectFiller . Test . TestPoco . Library ;
34using Tynamix . ObjectFiller ;
45
@@ -10,10 +11,10 @@ public class LibraryFillingTest
1011 [ TestMethod ]
1112 public void TestFillLibraryWithSimpleTypes ( )
1213 {
13- ObjectFiller < LibraryConstructorWithSimple > lib = new ObjectFiller < LibraryConstructorWithSimple > ( ) ;
14+ Filler < LibraryConstructorWithSimple > lib = new Filler < LibraryConstructorWithSimple > ( ) ;
1415 lib . Setup ( )
15- . IgnoreProperties ( x => x . Books ) ;
16- LibraryConstructorWithSimple filledLib = lib . Fill ( ) ;
16+ . OnProperty ( x => x . Books ) . IgnoreIt ( ) ;
17+ LibraryConstructorWithSimple filledLib = lib . Create ( ) ;
1718
1819 Assert . IsNull ( filledLib . Books ) ;
1920 Assert . IsNotNull ( filledLib ) ;
@@ -24,12 +25,12 @@ public void TestFillLibraryWithSimpleTypes()
2425 [ TestMethod ]
2526 public void TestFillLibraryWithListOfBooks ( )
2627 {
27- ObjectFiller < LibraryConstructorList > lib = new ObjectFiller < LibraryConstructorList > ( ) ;
28+ Filler < LibraryConstructorList > lib = new Filler < LibraryConstructorList > ( ) ;
2829 lib . Setup ( )
29- . IgnoreProperties ( x => x . Books , x => x . Name ) ;
30+ . OnProperty ( x => x . Books ) . IgnoreIt ( )
31+ . OnProperty ( x => x . Name ) . IgnoreIt ( ) ;
3032
31-
32- LibraryConstructorList filledLib = lib . Fill ( ) ;
33+ LibraryConstructorList filledLib = lib . Create ( ) ;
3334
3435 Assert . IsNotNull ( filledLib ) ;
3536 Assert . IsNotNull ( filledLib . Books ) ;
@@ -39,54 +40,74 @@ public void TestFillLibraryWithListOfBooks()
3940 [ TestMethod ]
4041 public void TestFillLibraryWithListOfIBooks ( )
4142 {
42- ObjectFiller < LibraryConstructorList > lib = new ObjectFiller < LibraryConstructorList > ( ) ;
43+ Filler < LibraryConstructorList > lib = new Filler < LibraryConstructorList > ( ) ;
4344 lib . Setup ( )
44- . IgnoreProperties ( x => x . Books )
45- . RegisterInterface < IBook , Book > ( ) ;
45+ . OnProperty ( x => x . Books ) . IgnoreIt ( )
46+ . OnType < IBook > ( ) . CreateInstanceOf < Book > ( ) ;
4647
47- LibraryConstructorList filledLib = lib . Fill ( ) ;
48+ LibraryConstructorList filledLib = lib . Create ( ) ;
4849
4950 Assert . IsNotNull ( filledLib . Books ) ;
5051 }
5152
5253 [ TestMethod ]
5354 public void TestFillLibraryWithPocoOfABook ( )
5455 {
55- ObjectFiller < LibraryConstructorPoco > lib = new ObjectFiller < LibraryConstructorPoco > ( ) ;
56+ Filler < LibraryConstructorPoco > lib = new Filler < LibraryConstructorPoco > ( ) ;
5657 lib . Setup ( )
57- . IgnoreProperties ( x => x . Books ) ;
58-
58+ . OnProperty ( x => x . Books ) . IgnoreIt ( ) ;
5959
60- LibraryConstructorPoco filledLib = lib . Fill ( ) ;
60+ LibraryConstructorPoco filledLib = lib . Create ( ) ;
6161 Assert . IsNotNull ( filledLib . Books ) ;
6262 Assert . AreEqual ( 1 , filledLib . Books . Count ) ;
6363 }
6464
6565 [ TestMethod ]
6666 public void TestFillLibraryWithDictionary ( )
6767 {
68- ObjectFiller < LibraryConstructorDictionary > lib = new ObjectFiller < LibraryConstructorDictionary > ( ) ;
68+ Filler < LibraryConstructorDictionary > lib = new Filler < LibraryConstructorDictionary > ( ) ;
6969 lib . Setup ( )
70- . RegisterInterface < IBook , Book > ( )
71- . IgnoreProperties ( x => x . Books ) ;
72-
70+ . OnType < IBook > ( ) . CreateInstanceOf < Book > ( )
71+ . OnProperty ( x => x . Books ) . IgnoreIt ( ) ;
7372
74- LibraryConstructorDictionary filledLib = lib . Fill ( ) ;
73+ LibraryConstructorDictionary filledLib = lib . Create ( ) ;
7574 Assert . IsNotNull ( filledLib . Books ) ;
7675 }
7776
7877 [ TestMethod ]
7978 public void TestFillLibraryWithDictionaryAndPoco ( )
8079 {
81- ObjectFiller < LibraryConstructorDictionary > lib = new ObjectFiller < LibraryConstructorDictionary > ( ) ;
80+ Filler < LibraryConstructorDictionary > lib = new Filler < LibraryConstructorDictionary > ( ) ;
8281 lib . Setup ( )
83- . IgnoreProperties ( x => x . Books , x => x . Name ) ;
82+ . OnProperty ( x => x . Books ) . IgnoreIt ( )
83+ . OnProperty ( x => x . Name ) . IgnoreIt ( ) ;
8484
8585
86- LibraryConstructorDictionary filledLib = lib . Fill ( ) ;
86+ LibraryConstructorDictionary filledLib = lib . Create ( ) ;
8787 Assert . IsNotNull ( filledLib . Books ) ;
8888 Assert . IsNotNull ( filledLib . Name ) ;
8989
9090 }
91+
92+
93+ public class Person
94+ {
95+ public string Name { get ; set ; }
96+ public string LastName { get ; set ; }
97+ public int Age { get ; set ; }
98+ public DateTime Birthday { get ; set ; }
99+ }
100+
101+ public class HelloFiller
102+ {
103+ public void FillPerson ( )
104+ {
105+ Person person = new Person ( ) ;
106+
107+ Filler < Person > pFiller = new Filler < Person > ( ) ;
108+ Person p = pFiller . Fill ( person ) ;
109+ }
110+ }
111+
91112 }
92- }
113+ }
0 commit comments