AutoFixture.AutoMoq doesn't set up your Test Doubles for you.
If you want to avoid having to specify a setup for IRepository.Data
in each and every test case, you can package the setup in a Customization.
public class RepositoryCustomization : ICustomization
{
public void Customize(IFixture fixture)
{
fixture.Register(() =>
{
var td = new Mock<IRepository>();
td.SetupGet(r => r.Data).Returns(fixture.CreateMany<Data>());
return td.Object;
});
}
}
With that, the following test passes:
[Fact]
public void AutoProperty()
{
var fixture = new Fixture().Customize(new RepositoryCustomization());
var repo = fixture.Create<IRepository>();
Assert.NotEmpty(repo.Data);
}
In theory it would be possible to write automated code that reflects over the members of an interface and sets up a return value for each member, but IMO, this should never be default behaviour for AutoFixture.AutoMoq.