Hope this helps...
[TestFixture] public class MyControllerTests {
private IWebStateProvider _mWebState;
private IUserSessionManagement _mUserSessionManagment;
private MyController _myController; [SetUp] protected void Init() {
//You can either use a stub or a mock for your dependencies.
//Read this: http://codebetter.com/jameskovacs/2009/02/10/mocks-vs-stubs/
_mWebState = MockRepository.GenerateMock<IWebStateProvider>();
_mWebState = MockRepository.GenerateStub<IWebStateProvider>();
_mUserSessionManagment = MockRepository.GenerateMock<IUserSessionManagement>();
_mUserSessionManagment = MockRepository.GenerateStub<IUserSessionManagement>();
_myController = new MyController(_mWebState, _mUserSessionManagment); } [Test]
public virtual void NowYouTestSomeMethodsOnMyController() { } }
Pouya Yousefi
http://shortersigs.com/52704D7CG3VP
________________________________
From: Easwaran Paramasivam <[email protected]>
To: Rhino.Mocks <[email protected]>
Sent: Friday, June 1, 2012 1:20 AM
Subject: [RhinoMocks] How to Mock using Rhino mock a class with constructor
I've a class as given below. How could I mock the class using Rhino
mock?
public class MyController
{
....
......
public MyController(IWebStateProvider webStateProvider,
IUserSessionManagement userSessionManagment)
{
this.mWebState = webStateProvider;
this.mUserSessionManagment = userSessionManagment;
}
......
}
--
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.
--
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.