Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

i am new to nunit. from the docs i understand we can do the testing when the method returns some values.then
how can i Test the void methods using nunit.
the methods does the connectivity functionality.

do i need to use stubs or mock objects can be used.
pls do help me with simple example.
Posted

1 solution

C#
using (MockRepository.Record())
{
   mockedObject.Expect(mock=>mock.VoidMethod(expectedParameterIfAny));
}
using(MockRepository.PlayBack())
{
   objectToTest->SomeMethod();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900