Пример #1
0
        public void aSyncNewDatabases()
        {
            using (var session = new SessionNoServerShared(s_sync1))
            {
                session.EnableSyncByTrackingChanges = true;
                using (var trans = session.BeginUpdate())
                {
                    for (uint i = 10; i < 50; i++)
                    {
                        var database = session.NewDatabase(i);
                        Assert.NotNull(database);
                    }
                    session.Commit();
                }
            }

            using (SessionBase readFromSession = new SessionNoServer(s_sync1))
            {
                using (SessionBase updateSession = new SessionNoServer(s_sync2))
                {
                    updateSession.SyncWith(readFromSession);
                }
            }

            using (SessionBase readFromSession = new SessionNoServer(s_sync1))
            {
                readFromSession.BeginRead();
                using (SessionBase updateSession = new SessionNoServer(s_sync2))
                {
                    using (var trans = updateSession.BeginRead())
                    {
                        Assert.AreEqual(updateSession.OpenAllDatabases().Count, readFromSession.OpenAllDatabases().Count - 1); // - 1 due to additional change tracking databases in original
                    }
                }
            }
        }