I'm trying to use the fluent mocking style of Rhino.Mocks and have the following code that works on a mock IDictionary object called 'factories':
With.Mocks(_Repository).Expecting(() =>
        {
         开发者_如何学Go   Expect.Call(() => factories.ContainsKey(Arg<String>.Is.Anything));
            LastCall.Return(false);
            Expect.Call(() => factories.Add(Arg<String>.Is.Anything, Arg<Object>.Is.Anything));
        }).Verify(() =>
        {
            _Service = new ObjectRequestService(factories);
            _Service.RegisterObjectFactory(Valid_Factory_Key, factory);
        });
Now, the only way I have been able to set the return value of the ContainsKey call is to use LastCall.Return(true) on the following line.
I'm sure I'm mixing styles here as Expect.Call() has a .Return(Expect.Action) method but I can't figure out how I am suppose to use it correctly to return a boolean value?
Can anyone help out? Hope the question is clear enough - let me know if anyone needs more info!
Cheers, Ben
I believe the following line will give you want you want:
Expect.Call(factories.ContainsKey(Arg<string>.Is.Anything)).Return(false);
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论