public void Init() { InMemoryHelper.FillData(sCfg, sSession, true); s = new Syncer(serverCon.ConnectionString, clientCon.ConnectionString, serverCon.ProviderName); Poster.MessagePosted += Syncer_MessagePosted; }
public async Task SendFromServerToFilledClient() { InMemoryHelper.FillData(clCfg, clSession, false, alterIds: true); var scopes = new[] { Scope.Icd, Scope.Reference }; var types = scopes.SelectMany(x => x.GetTypes()); var entitiesCount = new Dictionary <Type, int>(); object al = null; foreach (var type in types) { entitiesCount[type] = sSession.QueryOver(type.Name, () => al).RowCount(); } await s.SendFrom(Side.Server, scopes); // после загрузки проверяем справочные сущности на совпадение var checker = new AfterSyncChecker(clSession); checker.CheckReferenceEntitiesAfterDownload(s.AddedOnServerIdsPerType); foreach (var type in types) { Assert.AreEqual(entitiesCount[type], clSession.QueryOver(type.Name, () => al).RowCount()); } }
public override void Up() { foreach (var sqlRow in InMemoryHelper.GetScript(true, true, false)) { Execute.Sql(sqlRow); } }
public OrderCalculatorService(Argument argument) { this._argument = argument ?? throw new ArgumentNullException(nameof(argument)); this._argument.EnsureValues(); this._unitOfWork = InMemoryHelper.InMemoryReadonlyCsvUnitOfWork(this._argument.CatalogFile); this._settings = Settings.Instance; }
public async Task SendFromClient_NoCustomVocsOnServer() { InMemoryHelper.FillData(clCfg, clSession, false); await s.WithoutCustomVocsInDoc().SendFrom(Side.Client); var sCustoms = sSession.Query <Vocabulary>().ToList(); var clVocs = clSession.Query <Vocabulary>().ToList(); var common = sCustoms.Intersect(clVocs); Assert.AreEqual(0, common.Where(x => x.IsCustom).Count()); }
public async Task SendAddedPatientFromClient() { InMemoryHelper.FillData(clCfg, clSession, false); var clPatCount = clSession.Query <Patient>().Count(); await s.WithoutCustomVocsInDoc().SendFrom(Side.Client, Scope.Holder); // новый пациент на клиенте var p = new Patient("x"); session.DoSave(p); s = new Syncer(serverCon.ConnectionString, clientCon.ConnectionString, serverCon.ProviderName); await s.WithoutCustomVocsInDoc().SendFrom(Side.Client, Scope.Holder); Assert.AreEqual(clPatCount + 1, sSession.Query <Patient>().Count()); }
public ISession OpenSession() { //ExportSchemaToFile(Configuration, side); if (_session != null && _session.IsOpen) { _session.Close(); _session.Dispose(); } _session = SessionFactory.OpenSession(); _session.FlushMode = FlushMode.Commit; if (inmem) { new SchemaExport(Configuration).Execute(false, true, false, _session.Connection, null); InMemoryHelper.FillData(Configuration, _session); } return(_session); }
public async Task SendFromClient() { InMemoryHelper.FillData(clCfg, clSession, false); var scopes = Scopes.GetOrderedUploadScopes(); var types = scopes.SelectMany(x => x.GetTypes()); var entitiesCount = new Dictionary <Type, int>(); object al = null; foreach (var type in types) { entitiesCount[type] = clSession.QueryOver(type.Name, () => al).RowCount(); } await s.WithoutCustomVocsInDoc().SendFrom(Side.Client, scopes); foreach (var type in types) { Assert.AreEqual(entitiesCount[type], sSession.QueryOver(type.Name, () => al).RowCount()); } }
public void QueryTestInit() { InMemoryHelper.FillData(clCfg, clSession); }