Is there any framework for .NET to populate test data? [closed]

I am use c# and for unit testing and integration testing usually I need to populate fields automatically based on attributes.

Lets say we will test if we can write and get back user data to database.

  • I create a user object populate fields write user to database
  • Read user object from database
  • Check fields if what I write is same as what I read

Is there any framework to populate user with test data automatically and check if two object are have the same values?

Sample code may like this

User user = new User();
AutoPopulator.Populate(user);
user.Save();

You might find it relevant. Here is a list of few other frameworks as of today:

Well-known and respected:

  • NBuilder
  • AutoFixture
  • AutoPoco(Discontinued / Deprecated)
  • Bogus - C# port of faker.js with locale support. Used by Elasticsearch (NEST).

Little-known:

  • Hydrator
  • Fabricator

Unfamiliar:

  • TestDataGenerator
  • TestDataFactory (Discontinued)
  • TestData
  • Any-.Net

Take a look at NBuilder. It lets you build test objects with random data, incrementing values, and anything you can probably think of. All through a nice fluent interface.