From 7e1c11b9bb4bf146beeb8e96252c0b855fde9908 Mon Sep 17 00:00:00 2001 From: KurnakovMaksim Date: Wed, 30 Nov 2022 20:51:04 +0900 Subject: [PATCH 1/3] #173 Delete useless tabs --- README.md | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index bca8dc2..cafb3df 100644 --- a/README.md +++ b/README.md @@ -27,23 +27,23 @@ 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; } - } +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(); +var person = A.New(); ``` Tada! Your `person` is now filled with all the data you could ever dream of! @@ -55,7 +55,7 @@ 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(); +var people = A.ListOf(); ``` There...you have 25 people, this is the default in a list. @@ -65,12 +65,10 @@ 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(); - +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. ;) @@ -81,12 +79,12 @@ 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"; +var blogTitle = "GenFu"; + +GenFu.Configure() + .Fill(b => b.Title, () => { return blogTitle; }) - GenFu.Configure() - .Fill(b => b.Title, () => { return blogTitle; }) - - var post = A.New(); +var post = A.New(); ``` @@ -96,9 +94,9 @@ 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(); +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. From 38479d090ba4891c7d3b6fbcfe242da605a9c3bc Mon Sep 17 00:00:00 2001 From: KurnakovMaksim Date: Wed, 30 Nov 2022 20:52:53 +0900 Subject: [PATCH 2/3] #173 Add charp extension for code examples --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cafb3df..ec24a63 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Example Usage =========== Let's say you have a Person class like so: -``` +``` cs class Person { public string FirstName { get; set; } @@ -42,7 +42,7 @@ class Person And you want a new instance of Person. With GenFu, you just do this: -``` +``` cs var person = A.New(); ``` @@ -54,7 +54,7 @@ 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: -``` +``` cs var people = A.ListOf(); ``` @@ -64,7 +64,7 @@ There...you have 25 people, this is the default in a list. Cool beans, my brother or sister. Here's how GenFu rolls: -``` +``` cs GenFu.Configure() .Fill(p => p.Age) .WithinRange(19, 25); @@ -78,7 +78,7 @@ 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. -``` +``` cs var blogTitle = "GenFu"; GenFu.Configure() @@ -93,7 +93,7 @@ Method Fillers If your project uses one-parameter setter methods, you can use GenFu too! -``` +``` cs GenFu.Configure() .MethodFill(x => x.SetMiddleName(null)) var post = A.New(); From 45191e7df66a91a61ff02da90953e481bc8a5b6e Mon Sep 17 00:00:00 2001 From: KurnakovMaksim Date: Wed, 30 Nov 2022 20:56:30 +0900 Subject: [PATCH 3/3] #173 Fix first example tabs -> spases --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ec24a63..2fa6c0b 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,8 @@ class Person public int Age { get; set; } public int NumberOfKids { get; set; } - private string _middleName; - public void SetMiddleName(string name){ _middleName = name; } + private string _middleName; + public void SetMiddleName(string name){ _middleName = name; } } ```