Rhino Mocks verify a private method is called from a public method

Posted by slowcelica on Stack Overflow See other posts from Stack Overflow or by slowcelica
Published on 2010-06-17T01:35:26Z Indexed on 2010/06/17 1:42 UTC
Read the original article Hit count: 461

Filed under:
|
|

I have been trying to figure this one out, how do i test that a private method is called with rhino mocks with in the class that I am testing. So my class would be something like this.

Public class Foo
{
    public bool DoSomething()
    {
       if(somevalue)
       {
          //DoSomething;
       }
       else
       {
          ReportFailure("Failure");
       }
    }

    private void ReportFailure(string message)
    {
        //DoSomeStuff;
    }
}

So my unit test is on class Foo and method DoSomething() I want to check and make sure that a certain message is passed to ReportFailure if somevalue is false, using rhino mocks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about rhino