所以,使用NUnit和RhinoMocks:
//Defines basic behavior of all persistable domain objects
public interface IDomainObject {...}
//defines domain objects specific to the Security DB
public interface ISecurityDomainObject : IDomainObject {...}
//Defines a basic transactional data Repository; there are multiple implementors
//which each close TRest to the interface that defines their DB's domain classes
public interface IRepository<TRest> : IDisposable where TRest:IDomainObject
{
IUnitOfWork BeginUnitOfWork();
void CommitUnitOfWork(IUnitOfWork unitOfWork);
void RollBackUnitOfWork(IUnitOfWork unitOfWork);
void Save<T>(T domainObject, IUnitOfWork unitOfWork) where T : class, TRest;
IQueryable<T> QueryFor<T>(IUnitOfWork unitOfWork) where …Run Code Online (Sandbox Code Playgroud)