Skip to content
This repository has been archived by the owner on Oct 21, 2018. It is now read-only.

Warning on setup overriding #16

Open
ghost opened this issue May 27, 2011 · 1 comment
Open

Warning on setup overriding #16

ghost opened this issue May 27, 2011 · 1 comment

Comments

@ghost
Copy link

ghost commented May 27, 2011

public interface IService
{
string Do();
}

public class RhinoTest
{
[Test]
public void Test()
{
var service = MockRepository.GenerateStub();

  // in real some complex setup of bunch of mocks in separate method
  service.Stub(x => x.Do()).Return("first setup");

  // than I missed that service is already set up
  service.Stub(x => x.Do()).Return("second setup");

  var str = service.Do();
  Assert.That(str == "second setup"); // fails
}

}

Is it possible at least give a warning (or even fail a test with warning) that method Do is set up twice?

@ayende
Copy link
Owner

ayende commented May 27, 2011

Please use the rhino mocks mailing list:
http://groups.google.com/group/rhinomocks

On Fri, May 27, 2011 at 3:17 PM, Ed-ward <
[email protected]>wrote:

public interface IService
{
string Do();
}

public class RhinoTest
{
[Test]
public void Test()
{
var service = MockRepository.GenerateStub();

 // in real some complex setup of bunch of mocks in separate method
 service.Stub(x => x.Do()).Return("first setup");

 // than I missed that service is already set up
 service.Stub(x => x.Do()).Return("second setup");

 var str = service.Do();
 Assert.That(str == "second setup"); // fails

}
}

Is it possible at least give a warning (or even fail a test with warning)
that method Do is set up twice?

Reply to this email directly or view it on GitHub:
#16

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant