Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void Setup()
        {
            _env         = new TestEnvironment();
            _projectCode = TestContext.CurrentContext.Test.Name.ToLowerInvariant();
            var _projectDir = Path.Combine(_env.Settings.WebWorkDirectory, _projectCode);

            Directory.CreateDirectory(_projectDir);
            // Making a stub file so Chorus model.TargetLocationIsUnused will be false
            File.Create(Path.Combine(_projectDir, "stub"));
            _mongoProjectRecordFactory = MainClass.Container.Resolve <MongoProjectRecordFactory>() as MongoProjectRecordFactoryDouble;
            _mongoConnection           = _mongoProjectRecordFactory.Connection as MongoConnectionDouble;
            if (_mongoConnection == null)
            {
                throw new AssertionException("EnsureClone action tests need a mock MongoConnection that stores data in order to work.");
            }
        }