public async Task ImportHyperspinSystemsToDb__InsertOrUpdate() { var hsFe = _fe.GetFrontEnd("hyperspin", "TestData\\Hyperspin"); var systems = await hsFe.GetSystemsAsync(); Assert.True(systems?.Count() > 0); //Insert systems using (var uow = new UnitOfWork(Constants.CONN_STRING)) { uow.EnsureCreated(); foreach (var system in systems) { var existingSystem = uow.GamingSystemRepository.Get(x => x.Name == system.Name).FirstOrDefault(); if (existingSystem != null) { existingSystem.Enabled = system.Enabled; uow.GamingSystemRepository.Update(existingSystem); } else { uow.GamingSystemRepository.Insert(system); } } await uow.SaveAsync(); } }
public BulkImport(string connstring, string feType, string fePath, string rlPath) { var builder = new FrontEndBuilder(); FrontEnd = builder.GetFrontEnd(feType, fePath); _uow = new UnitOfWork(connstring); _rocketLauncher = new RocketLauncher(rlPath); }
public DeserializeHsTests() { _builder = new FrontEndBuilder(); _hypserspin = _builder.GetFrontEnd("hyperspin", "TestData\\Hyperspin"); }