Testing Entity Framework 3.5

What is the best way to write Unit tests when I restrict only to entities of EF 3.5?

+3
source share
1 answer

If you are trying to run unit test your queries, I highly recommend just setting up a test database and validating them with real data. Using IObjectSet<T>to replace the in-memory collection for your unit tests being tested is the idea of ​​BAD. There are differences between how the linq query is executed under linq-to-objects, and how it is analyzed in the T-SQL command, namely, how the zeros are processed. For instance,

db.People.Where(p => p.AccountNum == variable);

linq-to-objects ( , IObjectSet<T> ), . , , , null, ,

WHERE [peopleTableAlias].[AccountNum] = @param1

, @param1 null, , IS NULL.


-, EAT , , DataAccess, , DAO, , , , , (, Rhino).

- , IObjectSet<T> EF4, , . - , , - .

0

Source: https://habr.com/ru/post/1792546/


All Articles