So im actually trying to make a certain method return a different value 
depending on the string parameter that it sends. I saw that you can use 
Repeat.Once() to do what i'm looking for. But, i get an "Previous method 
'IConfigurationManager.get_AppSettings();' requires a return value or an 
exception to throw" even though the previous method returns a string 
Here is my code

_anomalieManager = MockRepository.GenerateMock<IAnomalieManager>();
            _configurationManager = 
            _itineraireManager = 
            manager = new SynchroManager(_anomalieManager, 
_configurationManager, _itineraireManager);

_configurationManager.Stub(p => p.AppSettings.Get(Arg<string>.Matches(i => 
i == "CrewCodes"))).Return("Charles").Repeat.Once();
_configurationManager.Stub(a => a.AppSettings.Get(Arg<string>.Matches(s => 
s == "NbJoursAvantAnomalie"))).Return("1").Repeat.Once();
It Crashes at the second line.

Any help would be appreciated thanks in advance!

You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to