KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm new to mocking, and I'm having a hard time solving an issue with UnitTesting. Say I have this code: public class myClass{ private IDoStuff _doer; public myClass(IDoStuff doer){ _doer = doer; } public void Go(SomeClass object){ //do some crazy stuff to the object _doer.DoStuff(object) //this method is void too } } Ok, so I want to UNIT test the Go method. I don't care what the _doer object does to the object once is gets it. HOWEVER, I do want to inspect what the _doer object has received. in PSEUDO code I want to achieve this: [Test] public void MyTest() { IDoStuff doer = Mocker.Mock<IDoStuff>(); Guid id = Guid.NewGuid(); //test Go method new MyClass(doer).Go(new SomeClass(){id = id}); Assert.AreEqual(id,MockingFramework.Method(DoStuff).GetReceived<SomeClass>().id); } Is this possible using Rhino, and if so, how do I achieve it? cheers
Tags (comma-separated)
Save Edits
Cancel