What is the error?

On Wed, Dec 10, 2008 at 11:06 AM, toranb <[EMAIL PROTECTED]> wrote:

>
> I have a very simple method that looks up a user to verify they exist,
> if so set some properties to false else set some properties to true.
>
> The strange part is that when I run my tests using MS Test (Visual
> Studio 2008 Team Suite) I get a fail, yet when I debug (without any
> changes, the test will pass)
>
> Any suggestions?  The method and test are shown below
>
> //method
>
> public void VerifyUser()
>     {
>         if (mView.UserID != null) {
>             User UserObject = mUserService.GetUserByID(mView.UserID);
>
>             if (UserObject != null) {
>                 //If the user is not active, set to invalid
>                 if (UserObject.Active == 1) {
>                     mView.UserIsValid = true;
>                 }
>                 else {
>                     mView.UserIsValid = false;
>                 }
>             }
>             else {
>                 mView.UserIsValid = false;
>             }
>         }
>         else {
>             mView.UserIsValid = false;
>         }
>     }
>
> //test code
>
>         IMasterView View = MockRepository.GenerateStub<IMasterView>
> ();
>         IUserService Service =
> MockRepository.GenerateStub<IUserService>();
>         MasterPresenter Presenter = new MasterPresenter(View,
> Service);
>
>         View.UserID = 1;
>         Service.Stub((object x) => x.GetUserByID(1)).Return(null);
>
>         Presenter.VerifyUser();
>
>         Assert.AreEqual(View.UserIsValid, false);
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to