AutoFixture: Configuring an Open Generics Specimen Builder
I have an object model that uses Open Generics (Yes, yes, now I have two problems; that's why I'm here :) :- public interface IOGF<T> { } class C { } class D { readonly IOGF<C> _ogf; public D( IOGF<C> ogf ) { _ogf = ogf; } } I'm trying to get AutoFixture to generate Anonymous instances of D above. However, on its own, AutoFixture doesn't have a built in strategy for building an IOGF<> and hence we observe: public class OpenGenericsBinderDemo { [Fact] public void X() { var fixture = new Fixture(); Assert.Throws<Ploeh.AutoFixture.ObjectCreationException>( () => fixture.CreateAnonymous<D>() ); }