public TestEnvironment(bool registerSettingsModelDouble = true, bool registerProcessingStateDouble = true, bool resetLfProjectsDuringCleanup = true, TemporaryFolder languageForgeServerFolder = null, bool registerLfProxyMock = true) { _resetLfProjectsDuringCleanup = resetLfProjectsDuringCleanup; _languageForgeServerFolder = languageForgeServerFolder ?? new TemporaryFolder(TestName + Path.GetRandomFileName()); Environment.SetEnvironmentVariable("FW_CommonAppData", _languageForgeServerFolder.Path); MainClass.Container = RegisterTypes(registerSettingsModelDouble, registerProcessingStateDouble, _languageForgeServerFolder.Path, registerLfProxyMock).Build(); Settings = MainClass.Container.Resolve <LfMergeSettings>(); MainClass.Logger = MainClass.Container.Resolve <ILogger>(); Directory.CreateDirectory(Settings.FdoDirectorySettings.ProjectsDirectory); Directory.CreateDirectory(Settings.FdoDirectorySettings.TemplateDirectory); Directory.CreateDirectory(Settings.StateDirectory); _mongoConnection = MainClass.Container.Resolve <IMongoConnection>() as MongoConnectionDouble; }
public TestEnvironment(bool registerSettingsModelDouble = true, bool registerProcessingStateDouble = true, bool resetLfProjectsDuringCleanup = true, TemporaryFolder languageForgeServerFolder = null) { _resetLfProjectsDuringCleanup = resetLfProjectsDuringCleanup; _languageForgeServerFolder = languageForgeServerFolder ?? new TemporaryFolder(TestName + Path.GetRandomFileName()); Environment.SetEnvironmentVariable("FW_CommonAppData", _languageForgeServerFolder.Path); MainClass.Container = RegisterTypes(registerSettingsModelDouble, registerProcessingStateDouble, _languageForgeServerFolder.Path).Build(); Settings = MainClass.Container.Resolve <LfMergeSettings>(); MainClass.Logger = MainClass.Container.Resolve <ILogger>(); Directory.CreateDirectory(Settings.LcmDirectorySettings.ProjectsDirectory); Directory.CreateDirectory(Settings.LcmDirectorySettings.TemplateDirectory); Directory.CreateDirectory(Settings.StateDirectory); _mongoConnection = MainClass.Container.Resolve <IMongoConnection>() as MongoConnectionDouble; // only call SingletonsContainer.Release() at the end if we actually create the // singleton _releaseSingletons = !SingletonsContainer.Contains <CoreGlobalWritingSystemRepository>(); }
static TestEnvironment() { // Need to call MongoConnectionDouble.Initialize() exactly once, before any tests are run -- so do it here MongoConnectionDouble.Initialize(); }