Unit testing and dataaccessadapter

Posts   
 
    
nabils
User
Posts: 46
Joined: 30-Nov-2008
# Posted on: 19-Jan-2009 23:46:59   

I currently access my data through a repository. So in my service layer I could have a method as below (just an example):

public IEnumerable<Customer> GetCustomersByCountry(string country)
List<Customer> custList;
using(customerRepostory.Adapter = new DataAccessAdapter()) 
{ 
    custList = customerRepostory.Find(c.Country==country).ToList(); 
} 
return custList;
}

Say I needed to test this method I mock the repository. Then I need to also mock or stub out the dataaccessadapter. I am using moq. Anyone have any ideas what is the best way to do this?

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 20-Jan-2009 08:46:05