If your objects are anemic enough, you might want to give AutoFixture a go:
var fake = A.Fake<>();
var fixture = new Fixture();
// If it's possible [1], AutoFixture will generate entire object graph
var user = fixture.CreateAnonymous<User>();
// Since data will be random [2], you can overwrite properties as you like
user.User.Subscription.Attributes = new List<Attributes>();
A.CallTo(() => fake.User).Returns(user);
- In order for it to work, your custom objects need to have public constructor and preferably avoid using interfaces (but that can be mitigated with auto-mocking extensions, like AutoFakeItEasy).
- The
.Build
method provides fluent API to customize objects autogeneration, so the randomness can be controlled