I'm using Natural Mocks (still really cool!). In one particular test method, typemock is not mocking one of the calls I've asked it to mock.. my test method ends up calling through to the real method, which is not what I wanted it to do.
My TestMethod:
using (RecordExpectations r = RecorderManager.StartRecording())
{
Deliver _deliver = new Deliver();
_deliver.Prep();
_deliver.Mature();
_deliver.Validate();
_deliver.Exec();
}
target.Execute();
tests a function in my production code that essentially looks like this (where _deliver in this class is a private member type Deliver):
Execute() {
_deliver.Prep();
_deliver.Mature();
_deliver.Validate();
_deliver.Exec();
}
When the test method calls Execute (target.Execute), Execute calls _deliver.Prep() -- which I expect to be Mocked, but it is not.
Looking at the TypeMock traces, it Declares an expectation for Prep (I see "Expect CCDeliverOperation.Deliver.Prep() 1 Time). The first call it seems to get is "CCDeliverOperation.Deliver.Prep()". After a few more unexpected calls, the exception from the real Prep occurs and the test ends. What is strange is that in the tree view, it lists "Prep (1)" under "Unmocked Instance -1". In "Instance 0" it lists "Prep (0/1)".
So how can the Prep be both called and not recorded? Thus my confusion.. What am I doing wrong? I have no other classes called Deliver and have verified Deliver means CCDeliverOperation.Deliver in all cases.
I'm using the Enterprise Edition of the product.. and Of course, I'm Init'ing my MockManager.
Thanks for the help!
-Eric
________
FIRST GENERATION SUBARU LEGACY