Get Factory definitions from a namespace or an assembly
I know that in the real ruby version, you just call FactoryGirl define method anywhere in a file and that adds the factory and makes it ready to be used.
However, given that in .NET we need to have a class to put code inside, that technique suggests to have a static class with the factory definitions inside a constructor perhaps or have some group of classes that contain inside a group of factory definitions.
Perhaps it could be useful to have a method like FactoryGirl.AddDefinitionsFromNamespace() or FactoryGirl.AddDefinitionsFromAssembly() and a group of methods like that, and define some interface to register factories, like:
public interface IFactoryDefinition<T>{
public Func Define();
}
or something like that. What do you think?
Sorry just posted using my other user, this is my personal one
In the past, I've just explicitly called some static helper methods in a test assembly startup class. I could see something like this being useful in a larger project.