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

How to fake entity class

2 Answers 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ari
Top achievements
Rank 1
ari asked on 05 Apr 2012, 03:00 PM
Hi

my tests fail

code to test

 DHP_Document documentObject = ctx.DHP_Document.Single(d => d.DocumentID == document.DocumentID);

documentObject    = null


How I can  mock DHP_Document   which is entity table in database ?

i have mocked  ctx.DHP_Document 
Mock.Arrange(() => CustomerEntities.DHP_Document).ReturnsCollection(CreateDHP_DocumentList());

2 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 09 Apr 2012, 11:41 PM
Hi Ari,

Thanks again for reporting the issue. If you have a sample project for the above exception then it will be a great starting point for debugging it further.

However, you can also write your query in the following way:

var document = (from dhp_doc in ctx.DHP_Document
where dhp_doc.ID == document.ID
select dhp_doc).Single();


Kind Regards
Mehfuz
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
ari
Top achievements
Rank 1
answered on 10 Apr 2012, 09:05 AM
hi 
thanks it works now
Tags
General Discussions
Asked by
ari
Top achievements
Rank 1
Answers by
Ricky
Telerik team
ari
Top achievements
Rank 1
Share this question
or