Hi Ignat
I think I understand what you're saying.
The thing is though, I'm afraid this just doesn't fit in with the
"vision" of NBuilder. The purpose of NBuilder is to give developers an
easy way of rapidly creating new test data. It's not designed to
recreate data that already exists. So with this in mind, I don't think
this is a feature I can consider adding.
One thing I want to add is that NBuilder's default mode doesn't give
you "Garbage-In" unless you opt to use the random property namer.
For instance if I clear out my 'Products' table then with NBuilder I
do...
Builder<Product>.CreateListOfSize(10).Persist();
... I KNOW that the value of the 'Description' column in the 8th row
in the Products table is now going to be exactly "Description8". I
know that the Price is going to be 8.00 and I know the quantity will
be 8.
Therefore you should be able to write your test to check for these
known values.
If you have a database with loads of reference data, what I would do
is have a production backup of the database for the tests, then in
your test setup code, clear out the non reference data tables, e.g.
// test setup
Database.ClearNonStatic();
// arrange - (create test data)
Builder<Product>......
// act
// assert
This is how I go about things - I hope this helps in some way?
Gareth