public void AddObjectToRepository <TEntity>( Func <TContext, ObjectQuery <TEntity> > query, TEntity testObject) where TEntity : EntityObject { TestHarnessRepository <TEntity> repository = GetTestHarnessRepository(query); repository.Register(testObject); }
private TestHarnessRepository <TEntity> GetTestHarnessRepository <TEntity>(Func <TContext, ObjectQuery <TEntity> > query) where TEntity : EntityObject { ITestHarnessRepository testHarnessRepository; string repositoryName = GetRepositoryName(query); if (!_repositoryByName.TryGetValue(repositoryName, out testHarnessRepository)) { testHarnessRepository = new TestHarnessRepository <TEntity>(); _repositoryByName.Add(repositoryName, testHarnessRepository); } return((TestHarnessRepository <TEntity>)testHarnessRepository); }