コード例 #1
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);

            LcmCache differentCache = LcmCache.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();
            }
        }