This is a migrated thread and some comments may be shown as answers.

Why is my Automock Container instance null?

3 Answers 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 22 May 2013, 09:35 PM
Hi All,
I hope you can help me with this. I am using a full version of JustMock and am attempting to mock a large class with multiple dependencies. Automocking seemed to be the way to go for this (unit) test. So I referenced the Telerik.JustMock.Container dll in my project, added the proper using statement and wrote the following simple test:

public void TestAutoMock()
{
// Arrange

var autoMockMFContainer = new MockingContainer<MyCustomClass>();

autoMockMFContainer.Instance.EstablishMyEmployee(10000, 2, 100007, 2, true, false);
}

This seems simple enough but it fails with a NullReferenceException. "Instance" is null. I am new to JustMock so I suspect the problem may lie with the project references or some configuration item but I don't know what it is. 

Can anyone offer any suggestions as to how I might get the Instance to not be null?

Thanks
MM

3 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 23 May 2013, 10:08 AM
Hi Mark,

Thank you for contacting Telerik support.

It is unfortunate that you are experiencing issues with JustMock. However, everything I read from your message seemed correct and this appears to be a bug in our product. Is it possible to wrap your test method along with your system under test (or you could make us different sample project reproducing the issue) and send it with your next reply for further investigation on our side.

Having the above, we will be able to find a fix much faster and also suggest a possible workaround for your exact case.

Thank you for the help in advance.

Regards,
Kaloyan
Telerik
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
0
Mark
Top achievements
Rank 1
answered on 28 May 2013, 04:17 PM
 

Good Morning Kaloyan,

I am unable to provide you the code for our system however, I whipped up the attached project this morning and it results in the same error. I have submitted a ticket on this issue (698356). I look forward to your reply.

Thanks,

MM





0
Kaloyan
Telerik team
answered on 29 May 2013, 07:21 AM
Hi Mark,

I have replied in Forum thread with ID:698356

I hope this helps.

Regards,
Kaloyan
Telerik
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Mark
Top achievements
Rank 1
Share this question
or