I fix this test. BackgroundWorker not raise event WorkerDoWork until
main test thread not complete stub for Init method with loop.
I change
view.Stub(x => x.Init()).WhenCalled(i =>
{
view.Raise(x
=> x.OnStart += null, this, EventArgs.Empty);
while (doIt)
Thread.Sleep(50);
});
on
view.Stub(x => x.Init()).WhenCalled(i =>
{
view.Raise(x
=> x.OnStart += null, this, EventArgs.Empty);
new Thread(()
=> { while (doIt) Thread.Sleep(50); }).Start();
});
and test comlete.
This is test done:
public void Test()
{
bool doIt = true;
var view = MockRepository.GenerateStub<IView>();
view.Stub(x => x.DoWork()).WhenCalled(i =>
{
doIt =
false;
});
view.Stub(x => x.Init()).WhenCalled(i =>
{
view.Raise(x
=> x.OnStart += null, this, EventArgs.Empty);
new Thread(()
=> { while (doIt) Thread.Sleep(50); }).Start();
});
var presenter = new Presenter(view);
presenter.Start();
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---