Closed GoogleCodeExporter closed 8 years ago
Hi Liam
Would you be able to give an example of the kind of thing you're after?
Currently NBuilder does give default values for all properties and you have the
ability to set any number of special values.
If you are creating a list of objects and you have a string property named
'Title',
NBuilder will give the properties the values 'Title1', 'Title2', 'Title3' etc.
Then
you can override this per property when you're building the objects, like this:
Builder<Product>.CreateListOfSize(10).WhereAll().Have(x => x.Description = "My
description").Build();
You can also set properties to random values and there is a contributed patch
which
will be released very soon which will allow you to specify a delegate for naming
particular types.
Are you asking for something different to this? I'd be more than happy to add
support
for something else if you need it.
Thanks
Gareth
Original comment by garethdo...@googlemail.com
on 23 Sep 2009 at 11:00
Thanks for your reply. In one of my projects I have a book builder. Every book
gets
the following default properties:
new Book { AllowAnonymousReaders = true, NavigationMode =
Book.NavigationMode.Automatic }
and then I can override properties for specific tests. The point is to have a
way to
set application specific defaults for a type.
Original comment by liam.mcl...@gmail.com
on 23 Sep 2009 at 8:14
Hi Liam
I see what you're saying. I think I could add that in to the BuilderSetup class.
Currently you could do this by creating a custom property namer. I will see if
I can
come up with a better way of doing this though, so that you can simply set
defaults
without having to inherit from a class.
I'll reply to this when I have something ready.
Gareth
Original comment by garethdo...@googlemail.com
on 29 Sep 2009 at 2:00
I talked to some other people who are using nbuilder, and they have achieved the
functionality I want by wrapping nbuilder and specifying per-type defaults in
their
wrapper. Works but it would be neater to have per-type defaults in the tool.
Love
your work.
Original comment by liam.mcl...@gmail.com
on 9 Oct 2009 at 5:32
Original comment by joshuajr...@gmail.com
on 8 Sep 2010 at 1:47
moved to github
Original comment by garethdo...@googlemail.com
on 1 Feb 2013 at 4:41
Found this via google search. What is the update on how to do this? I didn't
see it in the docs.
Original comment by andrew.v...@gmail.com
on 22 Jan 2015 at 9:42
Original issue reported on code.google.com by
liam.mcl...@gmail.com
on 23 Sep 2009 at 12:37