Пример #1
0
            public static IEnumerable <ProductionSite> GetProductionSites()
            {
                var repository = new ProductionSiteReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));
                var result     = repository.ListAsync(null, null, null).Result;

                return(result);
            }
Пример #2
0
            public static ProductionSite CreateProductionSite(string code, string name, string source)
            {
                // prepare
                var writeRepository = new ProductionSiteWriteRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));
                var readRepository  = new ProductionSiteReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));

                // create
                var productionSite = new ProductionSite(Guid.NewGuid(), code, name, source);
                IEnumerable <ProductionSite> productionSites = new List <ProductionSite>()
                {
                    productionSite
                };

                productionSites.ToList().ForEach(x => writeRepository.CreateAsync(x).GetAwaiter().GetResult());

                // result
                var result = readRepository.GetAsync(productionSite.Id).Result;

                return(result);
            }
 public void TestInitialize()
 {
     RepositoryTestsHelper.Init(Consts.Collections.ProductionSiteCollectionName);
     _repository = new ProductionSiteReadRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));
 }