Esempio n. 1
0
        public void Init()
        {
            InMemoryHelper.FillData(sCfg, sSession, true);
            s = new Syncer(serverCon.ConnectionString, clientCon.ConnectionString, serverCon.ProviderName);

            Poster.MessagePosted += Syncer_MessagePosted;
        }
Esempio n. 2
0
        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());
            }
        }
Esempio n. 3
0
 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;
        }
Esempio n. 5
0
        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());
        }
Esempio n. 6
0
        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());
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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());
            }
        }
Esempio n. 9
0
 public void QueryTestInit()
 {
     InMemoryHelper.FillData(clCfg, clSession);
 }