Posted By

cuperman007 on 09/22/11


Tagged

Mocking EF unit-testing Mole


Versions (?)

EF UnitTesting Data Repository


 / Published in: C#
 

  1. public class ProductDataRepository : IProductDataRepository
  2. {
  3. private MyDatabase_ModelContainer _model;
  4. protected internal MyDatabase_ModelContainer Model {
  5. get {
  6. if (_model == null) {
  7. _model = new MyDatabase_ModelContainer();
  8. }
  9. return _model;
  10. }
  11. }
  12.  
  13. public IQueryable<Product> GetProducts() {
  14. return Model.Products.Where(p => p.IsDeleted == false);
  15. }
  16. }

Report this snippet  

You need to login to post a comment.