Skip to content

Commit

Permalink
#78: converted WhereAll to All in the README.
Browse files Browse the repository at this point in the history
  • Loading branch information
crmckenzie committed Jul 6, 2018
1 parent ff3c3b7 commit b5e17aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 38 deletions.
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -123,7 +123,7 @@ Through extension methods you can extend NBuilder's fluent interface to add cust

In NBuilder nearly all of the public interface is implemented with extension methods. This of course means it's possible to add your own.

For example, out of the box the list builder has seven 'declarations' `WhereAll()`, `WhereRandom(n)`, `WhereRandom(n, start, end)`, `WhereTheFirst(n)`, `WhereTheLast(n)`, `AndTheNext(n)`, `AndThePrevious(n)`. However if you wanted to add your own,
For example, out of the box the list builder has seven 'declarations' `All()`, `WhereRandom(n)`, `WhereRandom(n, start, end)`, `WhereTheFirst(n)`, `WhereTheLast(n)`, `AndTheNext(n)`, `AndThePrevious(n)`. However if you wanted to add your own,

e.g. to return all the even or odd items, all you need to do is write a new extension method -` WhereAllEven()`

Expand All @@ -134,7 +134,11 @@ If, for example, you find yourself repeating yourself when creating test data an
For example say if rather than saying:

```c#
Builder<Product>.CreateListOfSize(10).WhereAll().Have(x => x.Title = "12345....[LongString].....12345").Build();
Builder<Product>
.CreateListOfSize(10)
.All()
.Have(x => x.Title = "12345....[LongString].....12345")
.Build();
```

You could instead create an extension method:
Expand All @@ -152,7 +156,7 @@ Giving you the ability to say:
```c#
Builder<Product>
.CreateListOfSize(10)
.WhereAll()
.All()
.HaveLongTitles()
.Build();
```
Expand Down
16 changes: 3 additions & 13 deletions src/FizzWare.NBuilder/Implementation/ListBuilder.cs
Expand Up @@ -7,29 +7,19 @@ namespace FizzWare.NBuilder.Implementation
{
public class ListBuilder<T> : IListBuilderImpl<T>
{
private readonly int size;
private readonly IPropertyNamer propertyNamer;
private readonly IReflectionUtil reflectionUtil;
private readonly T[] mainList;
private readonly DeclarationQueue<T> declarations;
public BuilderSettings BuilderSettings { get; set; }

public virtual int Capacity
{
get
{
return size;
}
}
public virtual int Capacity { get; }

public IDeclarationQueue<T> Declarations
{
get { return declarations; }
}
public IDeclarationQueue<T> Declarations => declarations;

public ListBuilder(int size, IPropertyNamer propertyNamer, IReflectionUtil reflectionUtil, BuilderSettings builderSettings)
{
this.size = size;
this.Capacity = size;
this.propertyNamer = propertyNamer;
this.reflectionUtil = reflectionUtil;
BuilderSettings = builderSettings;
Expand Down
22 changes: 0 additions & 22 deletions src/FizzWare.NBuilder/Messages.cs

This file was deleted.

0 comments on commit b5e17aa

Please sign in to comment.