DataServices Interface (i.e. IMenuGateway) design

Topics: Architecture
Apr 24, 2008 at 2:36 PM
Hello,
I am just curious of the design decisions for the following interface:

/// <summary>
/// The interface for the data access logic for the menu entity
/// </summary>
public interface IMenuGateway

So, we use the interface to access the data in our service like so:

IMenuGateway gateway = new MenuGateway();

Does the abstraction of the interface facilitate writing unit tests? or abstracting the data access layer in the scenario where one might swap out LINQ for say NHibernate?

My assumption is so the service is accessing it's data via a IMenuGateway interface, and as long as it has a valid contract (IMenuGateway ), it (service) is not concerned about the implementation, in fact it is decoupled from the data access implementation, which it should be, right?