How to Mock Indexed Property with Rhino Mocks?
-
07-07-2019 - |
Question
How can I Mock Indexed Property with Rhino Mocks ?
Solution
I'm assuming you mean a property using this[]
var mockClass = MockRepository.GenerateMock<MockClass>();
mockClass.Expect( m => m["key"] ).Return( "value" ); // return a value
mockClass.Expect( m => m["key2"] = "value2" ); // set a value
... some test in here using something that depends on mockClass...
mockClass.VerifyAllExpectations();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow