I'm wanting to use AutoFixture to automatically generate test data, and am currently using the mocking framework NSubstitute. However, I'm unable to generate random data for properties on interfaces. I have the following test case setup:
public interface IFoo
{
Guid Id { get; set; }
string Value { get; set; }
}
[Fact]
public void TestCase()
{
var fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
var foo = fixture.Create<IFoo>();
_output.WriteLine($"Id: '{foo.Id}'");
_output.WriteLine($"Value: '{foo.Value}'");
}
Which produces the following output:
Id: '00000000-0000-0000-0000-000000000000'
Value: ''
Creating a concrete class autogenerates these properties, just not interfaces. What's required to get the AutoFixture to generate data for interfaces? I'm assuming the cause is not enough setup in the Customize section, but not sure what to include there.