I can't get it to work. I've put my code below.
-----------------------------------------------------------------
Code
-----------------------------------------------------------------
#region UnableToShoot
/// <summary>
/// Class for testing DynamiteShooterStateMachine UnableToShoot
transitions
/// </summary>
[TestFixture]
public class UnableToShoot : DynamiteShooterStateMachineTestsBase
{
bool _sourceGroupEnabled;
delegate bool BoolPropertyDelegate();
[Test]
public void
SourceGroupEnabledWithDecoder_ShooterEnabled_UnableToShoot()
{
_sourceGroupEnabled = false;
using (_mockRepository.Record())
{
_sourceGroup =
_mockRepository.DynamicMock<ISourceGroup>();
_sourcePoint = null; // Type is ISourcePoint
_dynamiteShooterSm =
_mockRepository.PartialMock<DynamiteShooterStateMachineTestHarness>
(_sourceGroup, _sourcePoint);
SetupResult.For(_sourceGroup.Name).Return("TestingGroup");
Expect.Call(_sourceGroup.Enabled).IgnoreArguments()
.Do(new
BoolPropertyDelegate(GetSourceGroupEnabled)); // _sourceGroup.Enabled
is a bool property
SetupResult.For(_sourceGroup.EnabledWithDecoders)
.Return(false);
}
using (_mockRepository.Playback())
{
_dynamiteShooterSm.Init();
AssertThatCurrentStateIs(_dynamiteShooterSm.qUnableToShoot);
_sourceGroupEnabled = true;
DynamiteShooterStateMachineEvent shooterEnabled
= new DynamiteShooterStateMachineEvent
(DynamiteShooterStateMachineSignal.ShooterEnabled,
_sourceGroup);
_dynamiteShooterSm.Dispatch(shooterEnabled);
AssertThatCurrentStateIs(_dynamiteShooterSm.qAbleToShoot);
}
}
protected bool GetSourceGroupEnabled()
{
return _sourceGroupEnabled;
}
}
On Oct 8, 2:13 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> Yes, it does.You can do the same using a Do() in previous versions.
> See the documentation for the detaisl
>
>
>
> On Wed, Oct 8, 2008 at 9:10 PM, Ryan Vice <[EMAIL PROTECTED]> wrote:
>
> > Also, does this require Rhino 3.5?
>
> > On Oct 8, 2:08 pm, Ryan Vice <[EMAIL PROTECTED]> wrote:
> > > How does that translate to .Net 2.0 syntax?
>
> > > On Oct 8, 1:59 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
>
> > > > bool result = false;SetupResult.For( mockObkect.Foo ) .WhenCalled(
> > > > invocation=> invocation.ReturnValue = result ) ;
>
> > > > // make calls as usual
>
> > > > result = true;
>
> > > > On Wed, Oct 8, 2008 at 8:40 PM, Ryan Vice <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > I have a boolean member variable that I'm using setup results to
> > > > > return results from for testing and I need to have it return false
> > > > > until after i fire an event and then have it return true.
>
> > > > > Is there a way to do this?
>
> > > > > Thanks- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---