public void Setup() { if (SIL.PlatformUtilities.Platform.IsWindows) { const string tempPath = @"C:\Tmp"; Environment.SetEnvironmentVariable("TMP", tempPath); Environment.SetEnvironmentVariable("TEMP", tempPath); Directory.CreateDirectory(tempPath); } _env = new TestEnvironment(); _languageDepotFolder = new TemporaryFolder(TestContext.CurrentContext.Test.Name + Path.GetRandomFileName()); _lDSettings = new LfMergeSettingsDouble(_languageDepotFolder.Path); Directory.CreateDirectory(_lDSettings.WebWorkDirectory); LanguageDepotMock.ProjectFolderPath = Path.Combine(_lDSettings.WebWorkDirectory, TestContext.CurrentContext.Test.Name, TestLangProj); Directory.CreateDirectory(LanguageDepotMock.ProjectFolderPath); _lfProject = LanguageForgeProject.Create(TestLangProj); _mongoProjectRecordFactory = MainClass.Container.Resolve <LfMerge.Core.MongoConnector.MongoProjectRecordFactory>() as MongoProjectRecordFactoryDouble; // Even though the EnsureCloneActionWithoutMongo class has "WithoutMongo" in the name, the EnsureClone class which it inherits from // needs an IMongoConnection argument in the constructor, so we have to create a MongoConnectionDouble that we're not going to use here. var _mongoConnection = MainClass.Container.Resolve <IMongoConnection>(); _EnsureCloneAction = new EnsureCloneActionWithoutMongo(_env.Settings, _env.Logger, _mongoProjectRecordFactory, _mongoConnection); LanguageDepotMock.Server = new MercurialServer(LanguageDepotMock.ProjectFolderPath); }
private string GetGlossFromLanguageDepot(Guid testEntryGuid, int expectedSensesCount) { // Since there is no direct way to check the XML files checked in to Mercurial, we // do it indirectly by re-cloning the repo from LD and checking the new clone. _lfProject.FieldWorksProject.Dispose(); Directory.Delete(_lfProject.ProjectDir, true); var ensureClone = new EnsureCloneAction(_env.Settings, _env.Logger, _recordFactory, _mongoConnection); ensureClone.Run(_lfProject); return(GetGlossFromFdo(testEntryGuid, expectedSensesCount)); }