Closed GoogleCodeExporter closed 8 years ago
This appears to be fixed or not broken.
The following code creates real GUIDs.
Builder<Product>
.CreateListOfSize(10)
.WhereAll()
.Has(p => p._Id = Guid.NewGuid())
.Build();
Original comment by dhirs...@gmail.com
on 3 Dec 2009 at 6:54
Hi
Thanks for reporting this, I will look into how this can be fixed. I
purposefully
made it work this way but perhaps didn't consider the implications like this.
A workaround for now would be to inherit from SequentialPropertyNamer, override
GetGuid and just return Guid.NewGuid() instead.
Set the property namer using BuilderSetup.SetDefaultPropertyNamer()
Hope this helps until I get a proper fix.
Gareth
Original comment by garethdo...@googlemail.com
on 12 Jan 2010 at 12:09
A co-worker of mine made a case for why the GUIDs should remain sequential. You
want
your test data to remain exactly the same each time it's generated so that you
know
what the values will be each time. This would include GUIDs.
Perhaps adding some sort of flag to pick between real GUIDs and pseudo-GUIDs?
Although I have noticed that if I assign a GUID in the constructor of my object,
NBuilder won't replace it. Maybe another bug?
Original comment by dft...@gmail.com
on 12 Jan 2010 at 6:24
Hi dftian,
Did dhirshjr's suggestion of assigning the Guid using Guid.NewGuid() help at
all to give you unique GUIDs?
Also, I agree with your co-worker's defense of sequential GUIDs for unit tests
that are the same every time, but I can also see how unique GUIDs would be
important for persistence tests. Have you considered using Fluent NHibernate's
PersistenceSpecification
(http://wiki.fluentnhibernate.org/Persistence_specification_testing) to test
your NHibernate persistence? Perhaps that combined with Guid.NewGuid() might
serve you better?
Concerning properties assigned in the constructor being ignored...I believe
that is a feature of NBuilder designed to respect the design of the class being
built.
-Josh
Original comment by joshuajr...@gmail.com
on 2 Dec 2011 at 3:07
I wouldn't want to see see unique Guids whilst testing as this would make it
hard to assert against a random id.
Original comment by rich...@wildesoft.net
on 12 May 2012 at 6:55
this will be achievable with the new conventions (added these stories to github)
Original comment by garethdo...@googlemail.com
on 1 Feb 2013 at 4:44
Original comment by garethdo...@googlemail.com
on 1 Feb 2013 at 4:45
Original issue reported on code.google.com by
dft...@gmail.com
on 20 Nov 2009 at 1:07