예제 #1
0
        public void AddObjectToRepository <TEntity>(
            Func <TContext, ObjectQuery <TEntity> > query,
            TEntity testObject)
            where TEntity : EntityObject
        {
            TestHarnessRepository <TEntity> repository = GetTestHarnessRepository(query);

            repository.Register(testObject);
        }
예제 #2
0
        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);
        }