I've just began to work with Rhino-Mock, and I would like to test a basic method who check if pseudo and password is not null...
Here is my test method:
public void ValidateLoginTest()
{
// Arrange
var stubConnectionToTfs = MockRepository.GenerateStub<IConnectionToTfs>();
stubConnectionToTfs.Expect(x => x.ValidateLogin()).Return(false);
stubConnectionToTfs.Pseudo = "testPseudo";
stubConnectionToTfs.Password = "testPasswordl";
stubConnectionToTfs.Expect(x => x.ValidateLogin()).Return(true);
// Act
// Assert
stubConnectionToTfs.VerifyAllExpectations();
}
Maybe I didn't understand howrhino-mock works but I tought that if I called my ValidateLogin method without setting my Pseudo and Password properties, and then call VerifyAllExpectations() it will be enough to test my method...
The thing is, if I comment my Setters, the test pass anyway...
Thanks in advance
if you want to set expectancies you have to use a Mock, not a stub.