asiftasleem / nbuilder

Automatically exported from code.google.com/p/nbuilder
0 stars 0 forks source link

Add an overload with the index to the Have(), And(), Has() methods #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
You should be able to have access to the index of the item when using the
list builder.

Builder<Product>.CreateListOfSize(10)
    .WhereAll()
        .Have( (x, y) => x.Title = "Product " + y)
    .Build();

This would give you:

Product 1
Product 2
Product 3
Product 4

Original issue reported on code.google.com by garethdo...@googlemail.com on 17 Jun 2009 at 2:07

GoogleCodeExporter commented 8 years ago
This is exaclty what I need. Any idea on when you will be able to take this 
feature on?

Original comment by lilsli...@gmail.com on 24 Feb 2011 at 9:20

GoogleCodeExporter commented 8 years ago
I sent a pull request on GitHub to have this feature added:
https://github.com/garethdown44/nbuilder/pull/3

If you need it before it's merged into the master branch, you can check out my 
branch on GitHub:
https://github.com/seanfox/nbuilder/tree/provide_index_for_operables

Just build the project and use the resulting DLL.

Original comment by s...@techblogistech.com on 18 Oct 2012 at 10:04

GoogleCodeExporter commented 8 years ago
I discovered you can reference the id, so in you above example, you can do
.Have(x => x.Title = string.Format("Product {0}", x.Id))

Original comment by jkarnof...@gmail.com on 9 Nov 2012 at 9:14

GoogleCodeExporter commented 8 years ago
integrated on github

Original comment by garethdo...@googlemail.com on 1 Feb 2013 at 4:37