mercredi 29 juillet 2015

Unable to convert MSTest to NUnit Test using rhino mocks

I am following this post to implement MVP Pattern. http://ift.tt/1DbFdQQ

At the end of the article the testing is performed, which is performed in Microsoft Visual studio Test environment with Mock for Mocking the dependencies. In my project, I am using NUnit Test environment and RhinoMock for mocking depenecies.

In the article these are the test those are SetUp:

 mockView.SetupSet(v => v.Products = It.Is<List<ProductItem>>(i => i.Count == 3)).Verifiable();
    mockView.SetupSet(v => v.Total = It.Is<decimal>(t => t == 8.97m)).Verifiable();
    mockView.SetupSet(v => v.SubTotal = It.Is<decimal>(t => t == 8.97m)).Verifiable();
    mockView.SetupSet(v => v.Discount = It.Is<decimal>(t => t == 0m)).Verifiable();

I like to convert these lines to setup expectation and this is what I have tried:

_view = MockRepository.GenerateMock<IView>();
_controller = new Presenter(_view);            
_view.Expect(v => v.List = ???); //  List is my property defined in IView

NOTE:I am using NUnit and Rhino mocks for mocking.

Any help is really appreciated.

Aucun commentaire:

Enregistrer un commentaire