Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on object of an interface type when specifying the constructor #77

Closed
GoogleCodeExporter opened this issue Sep 7, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

It'd be nice if I could create this:

Builder<IFoo>.CreateNew().WithConstructor(() => new Foo()).Build();

Foo implements IFoo.

The same holds for lists:

var list = Builder<IFoo>.CreateListOfSize(1).WhereAll().AreConstructedUsing(() 
=> new Foo()).Build();


Currently, I have to cast the List<Foo>:

var list = Builder<Foo>.CreateListOfSize(10).Build().Cast<IFoo>.ToList();


Original issue reported on code.google.com by urs.enz...@gmail.com on 19 Oct 2011 at 1:48

@GoogleCodeExporter
Copy link
Author

Are you sure you're not looking for a mocking framework? I'm not quite sure I 
understand why a POCO (Plain Old CLR Object) should have an interface. I'm 
curious to know what you're doing that has led you to need interfaces on your 
POCOs.

Original comment by joshuajr...@gmail.com on 30 Nov 2011 at 10:42

@GoogleCodeExporter
Copy link
Author

No, I'm not looking for a mocking framework :-)

But, giving this a second thought, the current solution is just badly designed. 
It really should never have been an interface at all. Just needed some distance 
to realise that.

Thanks. Please close this issue.

Cheers
Urs

Original comment by urs.enz...@gmail.com on 1 Dec 2011 at 2:41

@GoogleCodeExporter
Copy link
Author

Original comment by joshuajr...@gmail.com on 1 Dec 2011 at 11:38

  • Changed state: Invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant