Various helper functions for testing FDO code
Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds a free translation and analyses to the specified segment on the specified
        /// paragraph
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private static void AddSegmentTrans(IStTxtPara para, int iSeg, string transFT)
        {
            AddSegmentFt(para, iSeg, transFT, para.Cache.DefaultAnalWs);
            ISegment seg = para.SegmentsOS[iSeg];

            FdoTestHelper.CreateAnalyses(seg, para.Contents, seg.BeginOffset, seg.EndOffset, true);
        }
Ejemplo n.º 2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Verifies the free translations for the segments of the specified paragraph.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private static void VerifyParaSegments(IStTxtPara para, params string[] segmentFTs)
 {
     Assert.AreEqual(segmentFTs.Length, para.SegmentsOS.Count);
     for (int i = 0; i < segmentFTs.Length; i++)
     {
         Assert.AreEqual(segmentFTs[i], para.SegmentsOS[i].FreeTranslation.AnalysisDefaultWritingSystem.Text,
                         "Free translation for segment " + i + " is wrong");
         FdoTestHelper.VerifyAnalysis(para.SegmentsOS[i], i, new int[0], new int[0]);
     }
 }
Ejemplo n.º 3
0
        public void StartFwRemoteDatabaseConnector()
        {
            FdoTestHelper.SetupStaticFdoProperties();
            m_sharedProject = true;
            RemotingServer.Start(FwDirectoryFinder.RemotingTcpServerConfigFile, FwDirectoryFinder.FdoDirectories, () => m_sharedProject, v => m_sharedProject = v);

            var connectString = String.Format("tcp://{0}:{1}/FwRemoteDatabaseConnector.Db4oServerInfo",
                                              "localhost", Db4OPorts.ServerPort);

            m_db4OServerInfo = (Db4oServerInfo)Activator.GetObject(typeof(Db4oServerInfo), connectString);
        }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 protected void SetupEverythingButBase()
 {
     if (m_cache != null)
     {
         DisposeEverythingButBase();
     }
     // We need FieldWorks here to get the correct registry key HKLM\Software\SIL\FieldWorks.
     // The default without this would be HKLM\Software\SIL\SIL FieldWorks, which breaks some tests.
     RegistryHelper.ProductName = "FieldWorks";
     FdoTestHelper.SetupStaticFdoProperties();
     m_cache         = CreateCache();
     m_actionHandler = m_cache.ServiceLocator.GetInstance <IActionHandler>();
 }
Ejemplo n.º 5
0
        public void StartFwRemoteDatabaseConnector()
        {
            // Change the Project Directory to some temporary directory to ensure, other units tests don't add projects
            // which would slow these tests down.
            m_oldProjectDirectory = FwDirectoryFinder.ProjectsDirectory;
            FwDirectoryFinder.ProjectsDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            Directory.CreateDirectory(FwDirectoryFinder.ProjectsDirectory);

            FdoTestHelper.SetupStaticFdoProperties();

            m_projectShared = false;
            RemotingServer.Start(FwDirectoryFinder.RemotingTcpServerConfigFile, FwDirectoryFinder.FdoDirectories, () => m_projectShared, v => m_projectShared = v);

            var connectString = String.Format("tcp://{0}:{1}/FwRemoteDatabaseConnector.Db4oServerInfo",
                                              "127.0.0.1", Db4OPorts.ServerPort);

            m_db4OServerInfo = (Db4oServerInfo)Activator.GetObject(typeof(Db4oServerInfo), connectString);

            // Arbitrary method call to ensure db4oServerInfo is created on server.
            m_db4OServerInfo.AreProjectShared();

            m_progress = new DummyProgressDlg();
        }