NSubsitute mocking container

187 views
Skip to first unread message

Ian Johnson

unread,
Dec 17, 2013, 10:54:21 PM12/17/13
to nsubs...@googlegroups.com
Hi All,

I'm wondering if people use an auto mocking container with NSubsitute? The reason I ask is because I'm working on creating an auto mocking container using Grace for dependency injection and NSubstitute for missing dependencies.

I'm curious if there are any special features people like or look for in their mocking containers.

Thanks
-Ian

David Tchepak

unread,
Dec 19, 2013, 3:49:58 PM12/19/13
to nsubs...@googlegroups.com
Hi Ian,
I've used one we bolted on to StructureMap, but I can't think of any special features we used; just basic auto-subbing dependencies that weren't manually injected into the AMC.
Regards,
David


--
You received this message because you are subscribed to the Google Groups "NSubstitute" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nsubstitute...@googlegroups.com.
To post to this group, send email to nsubs...@googlegroups.com.
Visit this group at http://groups.google.com/group/nsubstitute.
For more options, visit https://groups.google.com/groups/opt_out.

Ian Johnson

unread,
Dec 19, 2013, 9:20:47 PM12/19/13
to nsubs...@googlegroups.com
Hi David,

Thanks for the reply, at the moment that's pretty much the feature set I'm looking at, Concrete types are serviced by the container and missing interfaces are serviced with NSubstitute. Allowing you to do

SubstituteContainer container = new SubstituteContainer();

AnyType instance = container.Locate<AnyType>();

I am big fan of how easy it is to use NSubstitute so it is nice to keep the feature set simple but if anyone knows of any interesting auto mocking features I'm all ears.

Thanks again
-Ian

Alexandr Nikitin

unread,
Dec 20, 2013, 4:01:18 AM12/20/13
to nsubs...@googlegroups.com
Hi Ian,

I use it in my projects, it solves all my problems.
Maybe you can make this project better, instead of creating a new one.

Ian Johnson

unread,
Dec 20, 2013, 8:57:13 AM12/20/13
to nsubs...@googlegroups.com
Hi Alexandar,

That looks like an interesting project, The reason I'm putting this project together is because I've created a new Dependency Injection container that is arguably better than Autofac (it's 2-3x faster and has a larger feature set). I'm looking to create new projects that help developers be more productive with Grace rather than trying to help people keep using the status quo.

Performance Benchmark
http://www.palmmedia.de/blog/2011/8/30/ioc-container-benchmark-performance-comparison

Feature Benchmark
http://featuretests.apphb.com/DependencyInjection.html

So I can understand your hesitation to try something new but Grace offers some real upside compare to using your same old DI container.

-Ian

Alexandr Nikitin

unread,
Dec 20, 2013, 9:19:06 AM12/20/13
to nsubs...@googlegroups.com
Grace seems a very interesting project, thanks for pointing me out.

Ian Johnson

unread,
Dec 20, 2013, 10:41:04 AM12/20/13
to nsubs...@googlegroups.com
Yeah I'm a big of the NSubstitute syntax, while I like Moq and FakeItEasy NSubstitute feels like that next step in syntax

So hopefully if people like my container and like NSubstitute I can provide them some code to glue the two together without the developer having to do anything.

I'll check out the autosubstitute container tonight and see if I can get feature parity.

thanks
-Ian
Reply all
Reply to author
Forward
0 new messages