Is there some library to create object instances with dummy data in their properties?
I wonder if there is any .net library to create "dum开发者_JS百科my" instances of an object. In my particular scenario im dealing with classes with lots of fields, so manual creation is not practical.
It would not be that hard to code this. But maybe there is something out there. Thanks
There is. Check out NBuilder.
var products = Builder<Product>.CreateListOfSize(100)
.WhereTheFirst(10)
.Have(x => x.QuantityInStock = Generate.RandomInt(1, 2000))
.List;
And it goes from there. Pretty cool stuff.
精彩评论