diff --git a/README.md b/README.md index bca8dc2..2fa6c0b 100644 --- a/README.md +++ b/README.md @@ -26,24 +26,24 @@ Example Usage =========== Let's say you have a Person class like so: -``` - class Person - { - public string FirstName { get; set; } - public string LastName { get; set; } - public string Title { get; set; } - public int Age { get; set; } - public int NumberOfKids { get; set; } - - private string _middleName; - public void SetMiddleName(string name){ _middleName = name; } - } +``` cs +class Person +{ + public string FirstName { get; set; } + public string LastName { get; set; } + public string Title { get; set; } + public int Age { get; set; } + public int NumberOfKids { get; set; } + + private string _middleName; + public void SetMiddleName(string name){ _middleName = name; } +} ``` And you want a new instance of Person. With GenFu, you just do this: -``` - var person = A.New(); +``` cs +var person = A.New(); ``` Tada! Your `person` is now filled with all the data you could ever dream of! @@ -54,8 +54,8 @@ Tada! Your `person` is now filled with all the data you could ever dream of! Easy-peasy lemon squeezy, my friend! Ask for a list instead of a single instance like so: -``` - var people = A.ListOf(); +``` cs +var people = A.ListOf(); ``` There...you have 25 people, this is the default in a list. @@ -64,13 +64,11 @@ There...you have 25 people, this is the default in a list. Cool beans, my brother or sister. Here's how GenFu rolls: -``` - - GenFu.Configure() - .Fill(p => p.Age) - .WithinRange(19, 25); - var people = A.ListOf(); - +``` cs +GenFu.Configure() + .Fill(p => p.Age) + .WithinRange(19, 25); +var people = A.ListOf(); ``` And you're off to the races! Don't worry, I won't tell your boss how long that took. ;) @@ -80,13 +78,13 @@ Custom Property Fillers If you want to control how the property is set, you can use your own function (anonymous or otherwise) to do so. -``` - var blogTitle = "GenFu"; +``` cs +var blogTitle = "GenFu"; - GenFu.Configure() - .Fill(b => b.Title, () => { return blogTitle; }) - - var post = A.New(); +GenFu.Configure() + .Fill(b => b.Title, () => { return blogTitle; }) + +var post = A.New(); ``` @@ -95,10 +93,10 @@ Method Fillers If your project uses one-parameter setter methods, you can use GenFu too! -``` - GenFu.Configure() - .MethodFill(x => x.SetMiddleName(null)) - var post = A.New(); +``` cs +GenFu.Configure() + .MethodFill(x => x.SetMiddleName(null)) +var post = A.New(); ``` You can use any of the helper methods with setter methods, just like with properties.