asiftasleem / nbuilder

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

When creating List there doesn't seem to be a way to set the properties on the remaining items? #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
From the documentation on how to create lists I can see the following:

var list = Builder<Product>
.CreateListOfSize(30)
.WhereTheFirst(10)
    .Have(x => x.Title = "Special Title 1")
.AndTheNext(20)
    .Have(x => x.Title = "Special Title 2")
.Build();

What I'd like to see is the ability to do the following:

var list = Builder<Product>
.CreateListOfSize(30)
.WhereTheFirst(10)
    .Have(x => x.Title = "Special Title 1")
.AndTheRemaining()
    .Have(x => x.Title = "Special Title 2")
.Build()

This way I don't have to ensure that I hard code the exact remaining amount. 

Perhaps there is some syntax that will already do this for me?

Obviously this is a low priority since there is already a workaround...but
I thought it wouldn't hurt to make a suggestion...

Original issue reported on code.google.com by joshuajr...@gmail.com on 17 Feb 2010 at 1:13

GoogleCodeExporter commented 8 years ago
This has been completed as at revision 72. I've leveraged off the existing 
AndTheLast method.

Original comment by joshuajr...@gmail.com on 14 Sep 2010 at 11:09

GoogleCodeExporter commented 8 years ago

Original comment by joshuajr...@gmail.com on 14 Sep 2010 at 11:57

GoogleCodeExporter commented 8 years ago
I've made the change for this one but I still need to make some further changes 
to address feedback from the review.

Original comment by joshuajr...@gmail.com on 21 Oct 2010 at 11:48

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
A better implementation would be one that retrieves anything that hasn't 
already had something applied to it, not necessarily just the last x contiguous 
items.

Also if the syntax is changing to something like:

.TheFirst(10)
   .With(...)
.TheLast(10)
   .With(...)

would TheRemaining() be a better choice? Perhaps it would be best to make this 
TheRemaining() and release it along with the other new methods.

Original comment by garethdo...@googlemail.com on 6 Nov 2010 at 7:13

GoogleCodeExporter commented 8 years ago
Have pulled this from the codebase for now (by commenting). In the process of a 
refactor I came across this method and I want to give it some more thought. I'm 
not sure the current implementation would work since GetLastDeclaration() might 
not necessarily always return a RangeDeclaration(). I also think as per my last 
comment that the name implies it should be everything that hasn't been operated 
on. I'll revisit this once I've finished the refactor.

Original comment by garethdo...@googlemail.com on 5 Feb 2011 at 12:02

GoogleCodeExporter commented 8 years ago
Hey Gareth,

I agree with what you've said. Are you able to have a look into this one to 
figure out the best way to implement it?

-Josh

Original comment by joshuajr...@gmail.com on 13 Feb 2011 at 5:56

GoogleCodeExporter commented 8 years ago

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