(I didn't find a way to do this, from source code it appears it is not supported, but I might have overlooked it)
I would like to do something akin to:
(new Fixture())
.CreateAnonymous<Circle>(
new CircleSpecification { MinRadius = 1, MaxRadius = 5 }
);
So this is a variation on a similar seed-idiom present in AutoFixture already, but seed idiom is very hard coded (or so I think).
Quiestion: Is it possible to customize a fixture to accept an argument for a specimen?
The best idea I have so far is to build a special Specification class that includes the result object, so that you can do:
public class CircleSpecification {
public double MinRadius { get; set; }
public double MaxRadius { get; set; }
public Circle Circle { get; set; }
}
so that I can register CircleSpecificationSpecimenBuilder
that can be used:
Circle circle = Fixture.CreateAnonymous<CircleSpecification>(
new CircleSpecification { MinRadius = 0.0, MaxRadius = 5.0 }).Circle;
notice that to use CreateAnonymous with seed overload seed argument type has to match method return type.