something like bug

0 views
Skip to first unread message

oblomov

unread,
Feb 16, 2008, 4:03:00 AM2/16/08
to Rhino.Mocks
This works:
using (mocks.Ordered())
{
some expectation
}
But this doesn't:
using (mocks.Ordered())
{
using (mocks.Unordered())
{
// commented expectation
}
some expectation
}
I see some expectation "Expected #1, Actual #0"

Ayende Rahien

unread,
Feb 16, 2008, 4:44:06 AM2/16/08
to Rhino...@googlegroups.com
I need the full test case to understand this.
Also, what version are you using?

oblomov

unread,
Feb 17, 2008, 8:34:29 AM2/17/08
to Rhino.Mocks
using System;
using NUnit.Framework;
using Rhino.Mocks;

namespace Temp.Tests
{

public interface IMyService
{
void Func1();
void Func2();
void Func3();
}

[TestFixture]
public class Temp
{
MockRepository mocks;
IMyService service;

[SetUp]
public void Init()
{
mocks = new MockRepository();
service = mocks.CreateMock<IMyService>();
}
[TearDown]
public void Verify()
{
mocks.VerifyAll();
}
[Test]
public void TestWorks()
{
using (mocks.Ordered())
{
using (mocks.Unordered())
{
service.Func1();
service.Func2();
}
service.Func3();
}
mocks.ReplayAll();

service.Func2();
service.Func1();
service.Func3();
}
[Test]
public void TestDoesnotWork()
{
using (mocks.Ordered())
{
using (mocks.Unordered())
{
//service.Func1();
//service.Func2();
}
service.Func3();
}
mocks.ReplayAll();

//service.Func2();
//service.Func1();
service.Func3();
}
}

}

I think second test should work, but it doesn't.

oblomov

unread,
Feb 17, 2008, 8:37:19 AM2/17/08
to Rhino.Mocks
And I'm using RhinoMocks 3.3

Ayende Rahien

unread,
Feb 17, 2008, 9:50:46 AM2/17/08
to Rhino...@googlegroups.com
Reproduced.
I can actually figure out the logic for this.

Ayende Rahien

unread,
Feb 17, 2008, 9:59:17 AM2/17/08
to Rhino...@googlegroups.com
Fixed.
Reply all
Reply to author
Forward
0 new messages