Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <c>FdoTestBase</c> class.
        /// </summary>
        public SvFdoTestBase()
        {
            m_cache = FdoCache.CreateCache(FDOBackendProviderType.kMemoryOnly);
            // Init backend data provider
            var dataSetup = m_cache.ServiceLocator.GetInstance <IDataSetup>();

            dataSetup.StartupExtantLanguageProject(null);
            dataSetup.LoadDomain(BackendBulkLoadDomain.All);
            //(m_cache.MetaDataCacheAccessor as FdoMetaDataCache).AddVirtualClassesAndProps(
            //    new List<Type>(Assembly.GetExecutingAssembly().GetTypes()));

            m_cache.DomainDataByFlid.BeginNonUndoableTask();
            // Make French the vern WS.
            int frWs   = Cache.WritingSystemFactory.GetWsFromStr("fr");
            var french = Cache.ServiceLocator.GetInstance <ILgWritingSystemRepository>().GetObject(frWs);

            Cache.LanguageProject.VernWssRC.Add(french);
            Cache.LanguageProject.CurVernWssRS.Add(french);

            // Make English the analysis WS.
            int enWs    = Cache.WritingSystemFactory.GetWsFromStr("en");
            var english = Cache.ServiceLocator.GetInstance <ILgWritingSystemRepository>().GetObject(enWs);

            Cache.LanguageProject.AnalysisWssRC.Add(english);
            Cache.LanguageProject.CurAnalysisWssRS.Add(english);
            m_cache.DomainDataByFlid.EndNonUndoableTask();
        }
Exemplo n.º 2
0
        public void MultiMessageSynchronize_DifferentCache()
        {
            m_mainWnd.Expect("PreSynchronize", new IsAnything());
            m_mainWnd.ExpectAndReturn("Synchronize", true, new IsAnything());
            m_app.MainWindows.Add((IFwMainWnd)m_mainWnd.MockInstance);

            FdoCache differentCache = FdoCache.CreateCache(FDOBackendProviderType.kMemoryOnly, BackendBulkLoadDomain.All, null);

            try
            {
                DynamicMock otherMainWnd = new DynamicMock(typeof(IFwMainWnd));
                otherMainWnd.SetupResult("Cache", differentCache);
                otherMainWnd.Expect("PreSynchronize", new IsAnything());
                otherMainWnd.ExpectAndReturn("Synchronize", true, new IsAnything());
                m_app.MainWindows.Add((IFwMainWnd)otherMainWnd.MockInstance);

                m_app.SuppressSynchronize(Cache);
                m_app.Synchronize(SyncMsg.ksyncUndoRedo, Cache);
                m_app.Synchronize(SyncMsg.ksyncUndoRedo, differentCache);

                // This should call (Pre)Synchronize once for each main window
                m_app.ResumeSynchronize(Cache);

                m_mainWnd.Verify();
                otherMainWnd.Verify();
            }
            finally
            {
                differentCache.Dispose();
            }
        }