Skip to content

Commit 0bb1df5

Browse files
committed
Update README.md
1 parent 053d5b5 commit 0bb1df5

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,22 @@ The **.NET ObjectFiller** also supports IEnumerable<T> (and all derivations) and
1414
- [Examples](#examples)
1515
- [Let's start easy](#lets-start-easy)
1616
- [Let's use the fluent setup API](#lets-use-the-fluent-setup-api)
17+
- [Export ObjectFiller Settings](#export-objectfiller-settings)
1718
- [Ignore Properties](#ignore-properties)
1819
- [Setup Subtypes](#setup-subtypes)
1920
- [Fill objects with the IEnumerable interface](#fill-objects-with-the-ienumerable-interface)
2021
- [Fill objects with constructor arguments](#fill-objects-with-constructor-arguments)
2122
- [Fill Interface-Properties](#fill-interface-properties)
2223
- [Fill Lists and Dictionaries](#fill-lists-and-dictionaries)
24+
- [Detect Circular Dependencies](#detect-circular-dependencies
2325
- [Mix all up](#mix-all-up)
2426
- [Available Plugins](#available-plugins)
2527
- [IntRangePlugin](#rangeintegerplugin)
2628
- [MnemonicStringPlugin](#mnemonicstringplugin)
2729
- [RealNamePlugin](#realnameplugin)
2830
- [RandomListItem Plugin](#randomlistitem---plugin)
2931
- [PatternGenerator Plugin](#patterngenerator-plugin)
30-
- [Lorem Ipsum String Plugin](#lorem-ipsum-string-plugin)
32+
- [Lipsum String Plugin](#lipsum-string-plugin)
3133
- [Sequence Generator Plugin](#sequencegenerator-plugins)
3234
- [Write your own plugin](#write-your-own-plugin)
3335
- [Thank you](#thank-you-for-using-objectfillernet)
@@ -162,6 +164,36 @@ Here we say: Ok ObjectFiller, fill the property **```Name```** of a **```Person`
162164
The **```RealNamePlugin```** is a plugin which comes with the ObjectFiller assembly along.
163165
Its also really easy to write a plugin by yourself. I will show you that later.
164166

167+
###Export ObjectFiller Settings
168+
169+
```csharp
170+
public class HelloFiller
171+
{
172+
private FillerSetup _fillerSetup;
173+
public HelloFiller()
174+
{
175+
Filler<Person> pFiller = new Filler<Person>();
176+
177+
_fillerSetup = pFiller.Setup()
178+
.OnProperty(x => x.LastName).Use(new RealNames(RealNameStyle.LastNameOnly))
179+
.OnProperty(x => x.Name).Use(new RealNames(RealNameStyle.FirstNameOnly))
180+
.OnType<int>().Use(new IntRange(18, 75))
181+
.Result;
182+
183+
184+
}
185+
public void FillPerson()
186+
{
187+
Filler<Person> pFiller = new Filler<Person>();
188+
pFiller.Setup(_fillerSetup);
189+
190+
Person filledPerson = pFiller.Create();
191+
}
192+
}
193+
```
194+
Here we can see that i created the filler setup in the constructor and save the ```.Result``` of the filler setup to a private field. In the method ```FillPerson()``` we call the ```.Setup(_fillerSetup)``` with the setup of this private field! Thats good if you want to reuse your setup!
195+
196+
165197
###Ignore Properties
166198

167199
```csharp
@@ -634,9 +666,9 @@ The pattern generator can be extended, to allow combining built-in expressions a
634666
}
635667
```
636668

637-
###Lorem Ipsum String Plugin
669+
###Lipsum String Plugin
638670

639-
The "Lorem Ipsum" plugin generates some random text which contains the famous "Lorem Ipsum" text. Read more about the Lorem Ipsum [here](http://en.wikipedia.org/wiki/Lorem_ipsum)
671+
The "Lorem Ipsum" plugin generates some random text which contains the famous "Lorem Ipsum" text. Read more about the Lorem Ipsum [here](http://en.wikipedia.org/wiki/Lorem_ipsum). With the Lipsum plugin it is also possible to generate some other random text in english (Child Harold), german (In der Fremde) and french (Le Masque)
640672

641673
```csharp
642674
public class Person
@@ -653,13 +685,14 @@ The "Lorem Ipsum" plugin generates some random text which contains the famous "L
653685
{
654686
Filler<Person> pFiller = new Filler<Person>();
655687
pFiller.Setup()
656-
.OnType<string>().Use(new LoremIpsum(500));
657-
688+
.OnProperty(x => x.LastName).Use(new Lipsum(LipsumFlavor.LoremIpsum, 3, 5, minWords: 100))
689+
.OnProperty(x => x.Name).Use(new Lipsum(LipsumFlavor.InDerFremde));
658690
Person filledPerson = pFiller.Create();
659691
}
660692
}
661693
```
662-
This example generates a Lorem Ipsum text with 500 words for all ```string``` properties of the person.
694+
This example generates for the ```Lastname``` a Lorem Ipsum text with 3 paragraphs, min 5 sentences and min 100 words.
695+
On property ```Name``` it generates a text on german.
663696

664697
###SequenceGenerator Plugins
665698

0 commit comments

Comments
 (0)