Planning Rhino Mock 3.5 - The Lambda Edition

2 views
Skip to first unread message

Ayende Rahien

unread,
Feb 18, 2008, 4:54:30 AM2/18/08
to Rhino...@googlegroups.com

Now that I pushed all the current changes out, we need to start thinking about the next version. I am planning on seeing what kind of syntax I can get from the language using C# 3.0. As of yet, I don't have any concrete ideas about what should be done, so I am here to solicit ideas about what you want.

Syntax suggestions, patches, comments, etc are all welcome.

Peter Morris

unread,
Feb 18, 2008, 5:51:49 AM2/18/08
to Rhino...@googlegroups.com
> Syntax suggestions, patches, comments, etc are all welcome.

I have a request but it is not C#3 related :-)

//This next line is the request
IServiceProvider mockServiceProvider =
mocks.CreatePassThrough<IServiceProvider>(MyServiceProviderInstance);

SetupResult.For(mockServiceProvider.GetService(typeof(IMyService))).Return(mockMyService);

The idea is that anything I have not setup a result for should be passed
onto MyServiceProviderInstance. Basically this will save me from having to
do a SetupResult.For for some 10 to 20 calls when all I want to do is to
mock one of them.

Pete

Ayende Rahien

unread,
Feb 18, 2008, 5:53:41 AM2/18/08
to Rhino...@googlegroups.com
You can do that right now with partial mocks.

Peter Morris

unread,
Feb 18, 2008, 7:01:14 AM2/18/08
to Rhino...@googlegroups.com
> You can do that right now with partial mocks.

I have looked hard but can't find out how. The target object is an existing
instance of IServiceProvider, how can I create a partial mock that passes
everything through to that exact instance? The instance is important
because I am dealing with a specific cache etc.


Thanks

Pete

Owen Evans

unread,
Feb 18, 2008, 6:47:51 PM2/18/08
to Rhino...@googlegroups.com
I would love it if Callbacks would just accept Actions instead of specific delegates, actually all the use of the delegates at the moment would be useful if i could just put in a lambda expression.

Cheers
O

Ayende Rahien

unread,
Feb 18, 2008, 7:29:04 PM2/18/08
to Rhino...@googlegroups.com
No, existing instances are not supported, but why can't you create an instance through the mock repsitory?

On 2/18/08, Peter Morris <mrpm...@gmail.com> wrote:

Ayende Rahien

unread,
Feb 18, 2008, 7:29:36 PM2/18/08
to Rhino...@googlegroups.com
That is because the support for those was added in 1.1 days. :-)
 
Yes, this is certainly a good point.

 
Reply all
Reply to author
Forward
0 new messages