public static DamageCode CreateDamageCode(Guid id, string code, string name, bool DamagedQuantityRequired, string source) { // prepare var writeRepository = new DamageCodeWriteRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); var readRepository = new DamageCodeReadRepository(new DataContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); // create var damageCode = new DamageCode(id, code, name, DamagedQuantityRequired, source); IEnumerable <DamageCode> damageCodes = new List <DamageCode>() { damageCode }; foreach (var item in damageCodes) { writeRepository.CreateAsync(item).GetAwaiter().GetResult(); } // result var result = readRepository.GetAsync(damageCode.Id).Result; return(result); }
public void TestInitialize() { RepositoryTestsHelper.Init(Consts.Collections.DamageCodeCollectionName); _repository = new DamageCodeWriteRepository(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString))); }