[RhinoMocks] requires a return value or an exception to throw

2016-10-18 Thread Jake
Why not use .Do? It accepts the argument and returns anything you want.
In your case it will be:
.Do(new Func(arg=>{put your logic here}).Repeat.Any

-- 
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 rhinomocks+unsubscr...@googlegroups.com.
To post to this group, send email to rhinomocks@googlegroups.com.
Visit this group at https://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.


[RhinoMocks] requires a return value or an exception to throw

2016-10-17 Thread Charles Paquin
Im trying to make a method return a different value when called with 
different parameter. I have read that .Repeat.once() was pretty much the 
only way to do this. But, when i try it, i get "requires a return value or 
an exception to throw" even though my previous method actually work and 
returns a value.

Here is my code

 BaseManager.IsMockDatabaseMode = true;
_anomalieManager = 
MockRepository.GenerateMock();
_configurationManager = 
MockRepository.GenerateMock();
_itineraireManager = 
MockRepository.GenerateMock();
manager = new SynchroManager(_anomalieManager, 
_configurationManager, _itineraireManager);



 [TestMethod]
public void SynchronizeFlights_Success()
{
_configurationManager.Stub(p => 
p.AppSettings.Get(Arg.Matches(i => i == 
"CrewCodes"))).Return("Charles").Repeat.Once();
_configurationManager.Stub(a => 
a.AppSettings.Get(Arg.Matches(s => s == 
"NbJoursAvantAnomalie"))).Return("1").Repeat.Once();
}



Any help would be appreciated

-- 
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 rhinomocks+unsubscr...@googlegroups.com.
To post to this group, send email to rhinomocks@googlegroups.com.
Visit this group at https://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.